Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Troubles with non-ASCII (UTF-8 encoded) #1

Closed
simatic opened this Issue Mar 16, 2012 · 1 comment

Comments

Projects
None yet
2 participants

simatic commented Mar 16, 2012

Under Windows, msctexen does not handle correctly MSCs containing non-ASCII (UTF-8 encoded) characters: éèîà... (see example at the end of this post). More precisely, when you have such characters in your MSC, they do not come out correctly (they are omitted or replaced by strange characters.

The problem comes from the fact that mscgen handles correctly UTF-8 encoded characters when doing a PNG output, but not an EPS output which is used by msctexen (see mscgen issue: http://code.google.com/p/mscgen/issues/detail?id=7).

A bypass msctexen is to replace the 3 last lines of msctexen.sty (which generate an EPS file)

\immediate\write18{mscgen -T eps -i \mscfname.mscg -o \mscfname.eps >\mscfname.out 2> \mscfname.err}
\immediate\write18{epstopdf --gsopt=-dEPSCrop \mscfname.eps}

{\includegraphics[width=\msc@width]{\mscfname}}}

by the following lines (which generate a PNG file)

\immediate\write18{mscgen -T png -i \mscfname.mscg -o \mscfname.png >\mscfname.out 2> \mscfname.err}

{\includegraphics[width=\msc@width]{\mscfname.png}}}

Drawback of this bypass: the latex document should be able to handle PNG files.

Final word: thank you very much for msctexen: it helps a lot!

Michel

Extract of a Latex file not correctly generated by msctexen:

\begin{figure}[htbp]
\begin{center}
\caption{test with UTF-8 characters}
\renewcommand{\mscwidth}{14cm}
\begin{msc}
msc {
hscale = "1", arcgradient = "8";

The entities

A, B;

A->B [label="ç LATIN SMALL LETTER C WITH CEDILLA"];
A->B [label="è LATIN SMALL LETTER E WITH GRAVE"];
A->B [label="é LATIN SMALL LETTER E WITH ACUTE"];
A->B [label="ê LATIN SMALL LETTER E WITH CIRCUMFLEX"];
A->B [label="ë LATIN SMALL LETTER E WITH DIAERESIS"];
A->B [label="ì LATIN SMALL LETTER I WITH GRAVE"];
A->B [label="í LATIN SMALL LETTER I WITH ACUTE"];
A->B [label="î LATIN SMALL LETTER I WITH CIRCUMFLEX"];
A->B [label="ï LATIN SMALL LETTER I WITH DIAERESIS"];
|||; }
\end{msc}
\end{center}
\end{figure}

@unjello unjello closed this in 3f2b1f4 Nov 12, 2014

Owner

unjello commented Nov 12, 2014

it's been a while. sorry about that :)

I wasn't really been able to reproduce that. But even tho this should really be resolved by mscgen, I've added an option to choose between the two formats. You can say now:

\begin{msc}[format=png]

if you need UTF inside the labels. Be sure to use Mscgen's width attribute so the resulting image is useful for PDF :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment