I need to print some unicode characters (of box drawing family) in my document. I found this question that is very similar to mine but is valid only for XeLaTeX. There is a valid way to do this with pdfLaTeX or I have to use XeLaTeX instead?
[Tex/LaTex] Print box drawing characters with pdfLaTeX
pdftexunicodexetex
Related Solutions
Well in theory you can type your whole text in ascii, you only need to know which octets (8-bit-packets) to use:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[utf8]{inputenc}
\begin{document}
Euro (€): ^^e2^^82^^ac
ä: ^^c3^^a4
\end{document}
The main problem is to get the utf8-hex-notation (e282ac) from the unicode name (U+20AC). In theory it can be calculated (and inputenc is doing it when processing \DeclareUnicodeCharacter{20AC}{\texteuro}
) but I don't know a simple way to use the inputenc commands to get the values.
This input notation should work with the cjk-package (with utf8-option) too.
With the ucs-package (loaded when you use the option utf8x) you can use the command \unichar
. But you should be aware that ucs can clash with some packages, e.g. it is mentioned in the biblatex list of incompatible packages.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[utf8x]{inputenc}
\begin{document}
\unichar{"00E4}
\unichar{"20AC}
\end{document}
I have no idea if it would work together with cjk.
cjk offers also some text commands to enter symbols, e.g. \Li4 \chun1
. but I don't know if this covers your symbols too.
The code in my answer to TeX accents do not seem to work with fontspec and xe/lua/latex gives the idea, but for the dot above some additional code is needed.
\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Minion Pro} % a font without Latin Ext. Additional
\usepackage{newunicodechar}
\UndeclareUTFcomposite[\UTFencname]{x0101}{\=}{a}
\UndeclareUTFcomposite[\UTFencname]{x1E43}{\d}{m}
\UndeclareUTFcomposite[\UTFencname]{x1E45}{\.}{n}
\makeatletter
\let\d\relax
\DeclareRobustCommand{\d}[1]
{\hmode@bgroup
\o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-1ex}.\hidewidth}\egroup
}
\let\.\relax
\DeclareRobustCommand{\.}[1]
{\hmode@bgroup\vbox{% \o@lign has \vtop
\lineskiplimit\z@
\baselineskip\z@skip
\lineskip.25ex
\ialign {##\crcr\hidewidth.\hidewidth\crcr#1\crcr}}\egroup
}
\makeatother
\newunicodechar{ā}{\={a}}
\newunicodechar{ṃ}{\d{m}}
\newunicodechar{ṅ}{{\.n}}
\begin{document}
German Umlaute:
\begin{itemize}
\item Unicode characters: ä ö ü Ä Ö Ü
\item by \LaTeX command: \"a \"o \"u \"A \"O \"U
\end{itemize}
a with macron above:
\begin{itemize}
\item by function: ā
\item by \LaTeX: {\=a}
\end{itemize}
m with dot underneath:
\begin{itemize}
\item by function: ṃ
\item by \LaTeX: \d{m}
\end{itemize}
n with dot above:
\begin{itemize}
\item by function: ṅ
\item by \LaTeX: \.n
\end{itemize}
\end{document}
Best Answer
You can use the symbols, if available on the keyboard, or the macros.