[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cjk] Prepend \leavevmode to address@hidden, address@hidden, address
From: Qing Lee <address@hidden>
Subject: Prepend \leavevmode to address@hidden, address@hidden, address@hidden,
etc
Date: Mon, 02 Jun 2014 08:03:14 +0800
> The motivation for this request is based on the bug of the example
> in attached file.
Thanks for the report.
> I am sorry that this example is quite strange. But this bug is not
> very easy to reproduce. You can open `test-cjkutf8-cmap-bug.pdf'
> via a PDF browser and copy some text from it. Then paste them to
> some suitable place, you will find that the result is very weird.
> For example, the result of `一一 XYZ 2000` is `一一 乘乙乚 串丰丰丰
> `. The result of CJK characters is right, but others is wrong.
I've simplified your example to
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{gbsn}
\vspace*{19cm}
a
一
\end{CJK}
\end{document}
If you now cut and paste `a', the (incorrect) result is `乡'.
However, if you replace value `19' with, say, `18.5', everything is
just fine.
> It seems that \ToUnicode cmaps is also add to none-CJK font (here is
> \OT1/cmr/m/n/10). This is obviously wrong. I find the reason is
> that address@hidden is also defined in `\output` in this example.
> This led address@hidden to the wrong branch in `\output`.
Indeed, it's a bad interaction with the output routine. With value
`19', an additional blank page gets inserted at the very beginning of
the above sample for no obvious reason. This is a hint that \output
is seriously confused.
Under normal circumstances, the bug doesn't show up, as far as I can
see. With `normal' I mean that LaTeX's output routine has a chance to
correctly finish the current page, without being fooled by strange
vertical offsets that makes text appear below the text's bottom
margin.
I guess it should be straightforward to fix your document to avoid the
problem by slightly modifying vertical distances, or adjusting margins
or paper dimensions.
Unfortunately, I don't have time currently to debug this in great
detail, but using the above minimum example you might ask for help on
StackExchange, for example.
> If I add `\leavevmode` in the very beginning of the definition of
> address@hidden, say
>
> address@hidden@altchar##1##2##3{
> \ifvmode\leavevmode\fi %% added by me
> {\ifnum ##2 < address@hidden
> address@hidden
> \else
> ......
>
> The bug is gone and everything seems be OK.
Before adding such a fix it would be nice to really understand what's
going on...
Werner
- Re: [cjk] Prepend \leavevmode to address@hidden, address@hidden, address@hidden, etc,
Werner LEMBERG <=