How to handle unicode strings in a XeLaTeX document? - linux

an earlier question led me to XeLaTex (it was about LaTeX and Unicode). So I've got now this document:
\documentclass[a4paper]{article}
\usepackage[cm-default]{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{Arial}
\begin{document}
গ a ä ͷ
\end{document}
With the font "Arial" only the a and the ä are displayed, the other two characters are only a box each. If I remove the \setmainfont-command, only the a is displayed. If I change "Arial" to "Linux Libertine" I receive an error message:
Illegal fontname `Linux Libertine':
contains ' '
This is irritating, because the WikiPedia-Example about XeLaTeX has a font-name containing spaces.
What do I have to do to make all the given chars appear in my pdf-document?

If the fonts are correctly installed, they should work as expected (at least they work for me). However, neither Arial nor Linux Libertine contain all four characters. Especially the first character is supported only by a tiny number of fonts (see this list). The following example uses Code2000 and displays all characters correctly:
\documentclass[a4paper]{article}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\setmainfont{Code2000}
\begin{document}
গ a ä ͷ
\end{document}

Ah, I see; I should have actually tried out your example. The OpenType name of the font isn't Linux Libertine, it's Linux Libertine O. Alternatively, you can use the PostScript name:
\setmainfont{LinLibertineO}
Still, this font doesn't have all those four characters either. You might have a hard time finding one that does.

Apparently you need your font to support your Unicode characters. TeX Gyre Pagella, as suggested here, works for me for some Central European diacritic characters and Cyrillic.

sorry guys to answer so late, but I actually did what i wanted:
http://www.julianmoritz.de/dl/poster.pdf
regards!

you probably won't be able to load TeX Gyre Pagella with XeTeX or XeLaTeX. Switch back to regular LaTeX and do this in your preamble:
\usepackage[T1]{fontenc}
\usepackage{tgpagella}

Related

how to underline text in python 3.6.5

How can I print underlined text similar to what is shown on wikipedia in python? What unicode characters would I give to python to make this work?
In Python, arbitrary unicode characters can be expressed with \uXXXX where XXXX is a four-digit hex number identifying the code point.
Wikipedia shows the use of "combining low line" (U+0332).
Since it's a combining character, you need to place it after each character you want to be underlined.
So this code should print aaau̲zzz (u should be underlined in most browsers).
print('aaau\u0332zzz')
Note that this doesn't seem to work very well.
My gnome-terminal (which identifies as GNOME Terminal 3.26.2 Using VTE version 0.50.3 +GNUTLS), using Monospace Regular font, mis-renders the underline on the following character:
But if I copy the resulting text and paste it onto Stack Overflow, it seems to render correctly (Chrome on Linux):
aaau̲zzz
Unless I format it as code:
aaau̲zzz
In which case it doesn't "combine" at all.
Here's a screenshot of the above, in case your browser renders it differently:

Is there a way to display a vertical arrow character in a linux terminal using ncurses?

I'm trying to reproduce an old GUI screen in my application that uses ncurses for terminal display. The old GUI used characters that looked like this:
Is there a special ASCII code or other mechanism to do this with ncurses?
There are the alternate character set characters ACS_UARROW and ACS_DARROW, which you can display with addch and related functions, but what character they display depends on your terminal type.
You can use the arrows in unicode, here you can find a list of unicode arrows and the relative codes.
ncursesw has the support to wide character set, you should just set the locale:
setlocale(LC_ALL, "")
If your terminal is unicode aware, your font can display unicode and your locale is set to unicode, you should be able to simply
echo '↑ or ↓'

Vim UTF-8 encoding error on Windows

I have a text file with Polish characters. As long as I do not set :set encoding=utf-8 the characters are not displayed correctly. As soon as I set it to Unicode the characters are displayed but umlauts in error messages in Vim on the other hand are not displayed anymore.
Example:
E37: Kein Schreibvorgang seit der letzten <c4>nderung (erzwinge mit !)
Instead of the <c4> there should be the character Ä displayed. Can anybody explain me why this happens?
I'm experiencing similar issues (you can view some of the questions in my account info, or search for "central european characters" or "croatian characters").
Changing the encoding value changes the way Vim displays the characters - so, the way some of the characters are displayed is changed - that's why you're getting characters. You could probably solve your problem of Polish characters by choosing some other encoding value (one of the cpXXXX for example instead of utf8), but then you would lose the ability to display utf8 characters which can make Vim rather pretty. At least this works for my case (Croatian).
So, either use while writing polish texts one of the cpXXXX encoding values, or stick to utf8 completely. I recommend the first one. But do not change them.
Still working on that here.

changing vim's vertsplit character to │

This is, I assume, codepage related, but doesn't hurt asking.
How would one, on windows xp's cmd, gvim 7.2 change vertsplit character, so that instead of default | it is │ (so that it makes a full, and not an splitted line) ?
That character is usually changed with
set fillchars=vert:\|
and I can copy paste the ascii graphics line there, but it comes out as garbage. I suppose I would have to change vim's internal codepage for it to show correctly ?
Anyone knows how to do this ?
Ok, I'm really late to the party but this is what I do.
The way the characters are rendered depends on the font so you can get a continuous line using some fonts and not with others. I've found that using one of the following gives me an unbroken line.
Menlo
Monaco
Inconsolata
DejaVu Sans Mono
Consolas
Bitstream Vera Sans Mono
As far as settings go, the following is sufficient. Note that this is different from the | character commonly present on keyboards.
set fillchars=vert:\│
I've tried the following :
set enc=utf-8
set fillchars=vert:\│
And it worked, but the result weren't has good as you can hope, it's still not a full line (using the Consolas font, if you get a straight line with another font, I'd be interested to know which one).
This isn't exactly what you want, but I've set fillchars=\ and just use highlighting to color the blank space a different color. It's less elegant, but it looks fine to me.
Digging through the digraph table, I found that the "Box drawings light vertical" is perfect for this purpose. Vim's digraph table entry:
│ vv 2502 9474 BOX DRAWINGS LIGHT VERTICAL
To use it, press <c-k>vv in insert or command mode to get the character (see :h i_CTRL-K).
As pointed out by others, the setting is applied with set fillchars=vert:|

Using vim+LaTeX with Scandinavian characters

I want to create a lab write-up with LaTeX in Ubuntu, however my text includes Scandinavian characters and at present I have to type them in using /"a and "/o etc. Is it possible to get the latex-compiler to read these special characters when they are typed in as is? Additionally, I would like vim to "read" Finnish: Now when I open a .tex-document containing Scandinavian characters, they are not displayed at all in vim. How can I correct this?
For latex, use the inputenc option:
\usepackage[utf8]{inputenc}
Instead of utf8, you may use whatever else fits you, like latin1, as well.
Now the trick is to make your terminal run the same character encoding. It seems that it runs a character/input encoding that doesn't fit your input right now.
For this, refer to the "Locale" settings of your distribution. You can always check the locale settings in the terminal by issueing locale. These days, UTF8 locales are preferred as they work with every character imaginable. If your terminal's environment is set up correctly, vim should happily work with all your special characters without mourning.
To find out in which encoding Vim thinks the document is, try:
:set enc
To set the encoding to UTF-8, try:
:set enc=utf8
I can't help with vim, but for LaTeX I recommend you check out XeTeX, which is an extension of TeX that is designed to support Unicode input. XeTeX is now part of Texlive, so if you have TeX installed chances are you already have it.
I use the UCS unicode support: http://iamleeg.blogspot.com/2007/10/nice-looking-latex-unicode.html

Resources