1

I wan't to use latex to allow users to generate PDF-Reports on the fly. The problem is that a part of the document gets filled with information from the user-side. What I'm looking for is an environment in which every symbol can be used without escaping it. I just stumbled over this limitation when using a hashtag and the micro-symbol (µ) from the user side. The hashtag can be somehow handled, but not the micro-symbol.

As an alternative I could imagine using a tool which converts the special symbols to the escaped latex-pendents.

It's quite similar to this question, but there is no solution for the micro-symbol.

Would be great if someone could give me a hint!

EDIT: Here is an example for a template. The values in the %% will be replaced with some content from the user-side (for example "12.54µm").

\documentclass[12pt,a4paper]{article}
% Imports
\usepackage[utf8]{inputenc}
...
\begin{document}
    \section{%USERTITLE%}
        %USERDESCRIPTION1%: %USERVALUE1%
        %USERDESCRIPTION2%: %USERVALUE2%
        %USERDESCRIPTION3%: %USERVALUE3%
        ...
\end {document}
  • Welcome to TeX.SX! I'm not sure to understand the requirement. Can you give an example? – egreg Sep 01 '15 at 12:45
  • \AtBeginDocument{\catcode`\%=12 }? – Manuel Sep 01 '15 at 14:09
  • Thanks for the suggestion, Manuel! But how does this help concerning my µ-symbol? – freakinpenguin Sep 01 '15 at 14:40
  • I didn't understand the unicode part. If you mean that the user might want to input certain unicode characters, well, that's just a basic problem in TeX, not related to your problem. With inputenc + (newunicodechar or \DeclareUnicodeChar) or siunitx + \SI{12.54}{\micro\metre} you would solve that. – Manuel Sep 01 '15 at 15:32
  • The problem is, that the user does not know anything about tex. They will just enter symbols and don't use the tex escapes. – freakinpenguin Sep 02 '15 at 05:36

1 Answers1

1

I want to provide a late answer at this point. The easiest way to deal with unicode chars would be to switch your engine to e.g. XeLaTeX or LuaLaTeX. They handle full UTF-8 input including Greek/Cyrillic characters. The slightly slow-down in PDF creation should be no real drawback nowadays.

If you cannot switch your engine you should consider that it is a very high effort to have a \DeclareUnicodeChar for every char that should be inserted. Maybe as a further reference this TeX.SX post.

Another way you described was to write a tool to escape signs for LaTeX. A particular example for such a software can be found on this wonderful site.

TeXnician
  • 33,589