Closed rehnertz closed 1 year ago
Just a workaround, if I feed pdf to dvisvgm
then the baseline in svg is fine.
xelatex main.tex
dvisvgm --pdf -n main.pdf
PS: Your main.tex
could be simplified to
\documentclass{standalone}
\usepackage{ctex}
\begin{document}
Hello 你好 \LaTeX
\end{document}
It seems the mis-alignment only occurs with CJK fonts and the content in CJK fonts is vertically centered on some axis (perhaps the normal baseline), character by character.
% !TeX TS-program = xelatex
\documentclass{standalone}
\usepackage{fontspec}
\font\1="FandolHei"
\font\2="Latin Modern Mono"
\begin{document}
\parbox{\linewidth}{
Hello {\fontspec{FandolHei}FandolHei} World {\1FandolHei} \\
Hello {\fontspec{Latin Modern Mono}LM Mono} World {\2LM Mono}
}
\end{document}
PDF
SVG (generated from
.xdv
with -n
option)
Thanks for reporting the issue and thanks @muzimuzhi for posting the workaround. I've committed a quick fix that will hopefully work in most cases.
With the following LaTeX code
The output pdf of xelatex is correct:
However, when transforming xdv to svg, i.e.
the Chinese characters are shifted:
TexLive2023 on Windodws 11.