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

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 ↓'

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:

unidentified characters in terminal

I faced these strange abnormal characters when I was trying to calculate PI number in terminal over a Beowulf cluster.
how can I convert these characters into some legible characters?
it's interesting that when I make less processes , the result is normal .
Thanks in advance.
edit:
This was done with mpich 1 and with 1000 processes over a 3-computer cluster.
Because the output has lots of Unicode replacement characters, it looks as if the locale settings on your machine are not set to use UTF-8 encoding.
Of course, it could simply be from attempting to print binary data on the terminal. But locale is a possibility. In either case, the terminal is running with UTF-8 encoding and your output is not valid UTF-8 text.
Resetting the terminal will not be helpful; it is the application (or your use of it) which is the problem.
Further reading:
Overcoming frustration: Correctly using unicode in python2
Avoid printing unicode replacement character in Java

Display accented letters in iTerm2

When I type accented letter in iTerm2, I get a strange behaviour. For instance when i type "sélectionner", iTerm2 displays "sé lectionner".
Preferences/Profiles/Terminal/Character Encoding is set to Unicode (UTF-8).
Any idea of what I should do to have iTerm2 display characters correctly?
Thanks
Make sure "prefs>profiles>text>treat ambiguous-width characters as double-width" is turned off.
See also this issue.

How to handle unicode strings in a XeLaTeX document?

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}

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