Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Please how can I insert these unicode symbols in the range u2400 to u2421. They are names of control characters.

You can see them here: http://unicode.org/charts/PDF/U2400.pdf

I could find the package keystroke which has very nice keys, but that is not what I want.

Thanks!

-- Edited:

Quoting Marco: "The problem is to find a font that contains these characters."

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

It mostly depends on your setup. If you're using XeLaTeX or LuaLaTeX and fontspec it all boils down to

\newfontfamily{\lowasciifont}{Free Sans}
\newcommand{\lowascii}[1]{{\lowasciifont\char\string"#1}}

in the preamble and \lowascii{2400} and so on in the document. Example:

\documentclass{article}
\usepackage{fontspec}
\newfontfamily{\lowasciifont}{Free Sans}
\newcommand{\lowascii}[1]{{\lowasciifont\char\string"#1}}

\begin{document}
\lowascii{2400} \lowascii{2401}
\end{document}

enter image description here

Without XeLaTeX or LuaLaTeX I don't know of any font that has those symbols. One might conceive to create suitable Type1 fonts from FreeSans, but it's quite a job and probably its easier to fake those symbols with some low level trick.

Here's an example:

\usepackage{lmodern}
\newcommand{\lowascii}[1]{\innerlowascii#1\relax}
\def\innerlowascii#1#2#3\relax{%
  $\vcenter{
  \fontsize{4}{4}\sffamily
  \offinterlineskip
  \kern-1.2ex
  \sbox0{#1}\dimen0=\wd0 \box0
  \sbox0{#2}\moveright\dimen0\copy0 \advance\dimen0\wd0
  \if\relax\detokenize{#3}\relax\else\moveright\dimen0\hbox{#3}\fi}$}

In the text you can say

A \lowascii{NUL} \lowascii{LF} B

and get

enter image description here

share|improve this answer
    
You did a very good job on this explanation. Thanks! I think if I don't find a font, I'll probably do the trick you taught. –  Dr Beco Apr 10 '12 at 15:02
3  
The "Free Mono", "Free Sans" and "Free Serif" fonts have the symbols. Also "Arial Unicode MS". –  egreg Apr 10 '12 at 15:09
    
Dear @egreg, can't find more information about free mono and free sans. Google think these words are to wide as keywords. Do you know a place where I can find the name of the symbols inside these fonts? Thanks in advance! –  Dr Beco Apr 10 '12 at 15:34
    
@DrBeco The "Free" fonts are already available in TeX Live: they are part of the GNU project. –  egreg Apr 10 '12 at 15:36
    
Ok, but I still need to know the character name. For example, like in keystrokes package, I can use \Del. How can I get the character names for those fonts? –  Dr Beco Apr 10 '12 at 15:38
show 6 more comments

The problem here is not how to enter the characters. You enter them as you enter all other characters, which depends on your keyboard layout and editor configuration. Either you enter them directly, you create a mapping for often used ones or you enter the unicode values directly. E.g. in vim you can do this with <CTRL-V>u<unicode_number>.

The problem is to find a font that contains these characters.

share|improve this answer
    
Thanks for clarification. I'll edit the question to include the problem description you gave. –  Dr Beco Apr 10 '12 at 14:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.