[pdftex] [OT] latex questions

Heiko Oberdiek oberdiek at uni-freiburg.de
Wed Feb 5 16:07:26 CET 2003

On Wed, Feb 05, 2003 at 07:55:08PM +0700, The Thanh Han wrote:

> while translating "the not so short introduction into latex2e" to
> vietnamese, I have two latex questions:
> 1) codes between \begin{example} ... \end{example} are not typeset
> properly. If I have some vietnamese characters in the examples, they are
> typeset under the caret notation like ^^be. Using tcx instead of inputenc
> fixed this problem, however I wonder why I cannot use inputenc.

I have looked at the sources of
and found that the example environment uses the verbatim package.
First it writes the contents to a file and reads this later
by \verbatiminput.
  \start at line can be used as hook to reset the catcode of ^, so that
characters given by the caret notation are recogniced. Of course
the of ^ for the character ^ is now problematic. You can also give it in
caret notation: ^^e5. However, LaTeX will complain a "not in math mode"
error, so this character has to be filtered out and replaced by a
safe form (eg. with catcode 12).

Example file:


\newwrite\example at out
    \immediate\openout \example at out \jobname.exa
    \def\verbatim at processline{%
      \immediate\write\example at out{\the\verbatim at line}%
    \verbatim at start
    \immediate\closeout\example at out
    \expandafter\def\expandafter\verbatim at startline\expandafter{%
      \verbatim at startline
      \catcode`\^=7 %
    \let\saved at verbatim@addtoline\verbatim at addtoline
    \def\verbatim at addtoline##1{%
      \caret at verbatim@addtoline##1^\@nil
      \expandafter\saved at verbatim@addtoline\expandafter{\the\toks@}%
\def\caret at verbatim@addtoline#1^#2\@nil{%
      \caret at verbatim@addtoline #2\@nil

\Large This is large.
Umlauts: äüöß
Caret notation: ^^be
Math: 2^^5e10=1024

> 2) how can I have bookmarks displayed closely to the original text, ie if
> a character is avail. in PDFDocEncoding then it is written as is, otherwise
> an accented letter should be replaced by its base letter. For examle, if \~\i
> is not in PDFDocEncoding then it should be written out as i. hyperref seems
> to ignore characters that are not in PDFDocEncoding.

It does ignore:
  \section{Hello: \~\i}
  Package hyperref Warning: Glyph not defined in PD1 encoding,
  (hyperref)                removing `\texttilde+\i' on input line 5.

Solution, add the following after \usepackage{hyperref}:

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>

More information about the pdftex mailing list