5

I'm writing a program in Java which generates a PDF for something using LaTeX. In this PDF I have to include arbitrary Unicode Characters which I get from a File.

\documentclass[11pt,a4paper]{scrartcl}

\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % or \usepackage[utf8x]{inputenc} for mor characters
\usepackage{eurosym}
\usepackage{textcomp}

\begin{document}

¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ® ¯ ° ± ² ³ ´ µ ¶  · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ 

le\#bla\%dd\@\euro{}i9pi\{\_\}d    dsa ddd4(ozfertig

\char"2200

\end{document}

This provides me with a lot of UTF-8-Characters but not all. In the example above the line with \char"2200 doesn't work everything else does. If I could find a Font which includes every UTF-8-Symbol (even if its just mapped to a ?) this should work. Is there such a font?

If not, is there a document which lists the range of defined Symbols with the packages I am using, such that I can replace the rest with some defined character?

I cannot use XeTeX or LuaTeX, I'm stuck with pdfLaTeX.

  • 2
    You simply can't use \char"2200 with pdflatex. – egreg Jun 3 '13 at 15:13
  • Is the reason you can't use XeTeX or LuaTeX insurmountable? Because that seems to be the only way to do what you want to do. – Alan Munn Jun 3 '13 at 15:17
  • Welcome to TeX.SX! Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. – doncherry Jun 3 '13 at 15:19
5

You mean Unicode characters rather than UTF-8 characters. Unicode code points are in the range hex 0-10FFFF and pdflatex fonts are restricted to hex 0-FF so you would need thousands of fonts to cover the full Unicode range and a TeX macro definition for each character (or range of characters that can be mapped as a block).

5

This is something like a hack. If a Unicode symbol definition has been loaded with encodings package such as textcomp or options to fontenc, with \UnicodeChar{abcd} you can access to it, or ? will be printed.

\documentclass[11pt,a4paper]{scrartcl}

\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{eurosym}
\usepackage{textcomp}

\makeatletter
\begingroup
  \def\DeclareUnicodeChar#1#2{\global\@namedef{UC@#1}{#2}}
  \def\cdp@elt#1#2#3#4{%
     \lowercase{\InputIfFileExists{#1enc.dfu}{}{}}%
  }\cdp@list
\endgroup
\def\UnicodeChar#1{\@ifundefined{UC@#1}{?}{\@nameuse{UC@#1}}}
\makeatother

\begin{document}

¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ® ¯ ° ± ² ³ ´ µ ¶  · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ 

le\#bla\%dd\@\euro{}i9pi\{\_\}d    dsa ddd4(ozfertig

\UnicodeChar{2200}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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