Since 2003 or 2004 I am writing a 1600+ pages script. In it I use original cites from Chinese, Arabic and Old Greek sources, mostly simply by copy and paste (no, I am neither capable of Greek, Chinese or Arabic!). Thanks to the abilities of LaTeX that should work, I hoped.
My system is as follows: Win7 with TeX Live 2019 full install, installed and updated today, to be sure, I don't work with outdated versions. My sources are written under Winshell, coded UTF-8, compiled under LaTeX.
First everything seemed to work like a charm: In the beginning of my script I had a mixture of Old Greek and Chinese cites, in the end Arabic cites, everything seemed to work more or less (well, there was one problem though, with which I started my career of writing posts on StackExchange some two days ago and got great help here, but that was another problem -- this is only my second post, encouraged by your help with the first one, to be found under PdfLaTeX: Why is arabic output slightly different from arabic input?)
But then I added some Greek cites near the end of my script, after the Arabic ones -- and suddenly those came out quite crippled (at that time, till this very morning, I was working under TeX Live 2018, only this morning I dated up).
A minimum working example for that problem looked like this:
\documentclass{report}
\usepackage[LGR,T1]{fontenc}
\usepackage[greek,ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{arabtex}
\usepackage{utf8}
\newcommand\ararab[2][]{
\setcode{utf8}
\RL{#2}}
\begin{document}
\foreignlanguage{greek}{Παίδων τοίνυν ἡμῶν ὅντων καθαιρεῖ μὲν τὸν}
\ararab{أبو علي الحسن بن الهيثم}
\foreignlanguage{greek}{Παίδων τοίνυν ἡμῶν ὅντων καθαιρεῖ μὲν τὸν}
\end{document}
So there is an Old Greek text followod by Arabic, followed by Old Greek again. Under TeX Live 2018 this compiled without an error message. Afterwards the first Greek and the Arabic text came out quite ok. But the second Greek text, which in the source is identical with the first one, came out with a lot of different letters...
But now, that I have switched over to TeX Live 2019 this morning with PdfLaTeX I get lots of error messages -- but only for the second Greek text, not for the first, identical one.
I was not able to solve that, although I tried hard since weeks -- the install of TeX Live 2019 this morning was my last attempt to solve that problem. So I began looking for other opportunities. Switching to XeTeX or LuaTeX would surely have solved these issues. But then I would have to do something with the massive use of psfrag
-- which is the main cause, that I still stick with good old LaTeX in this script.
So I rather tried to get happy with babel
and it's option arabic
. But as soon as I add arabic
to the options of babel
(which I use for Greek and German anyway), the compilation crashes. Now today I have twice tried to reduce my script to a minimum working example. Both times with much different results, but see yourself:
Example 1:
\documentclass{report}%
\usepackage[arabic,ngerman]{babel}
\usepackage{mparhack}
\usepackage{microtype}
\begin{document}
\thispagestyle{plain}
Hallo
\end{document}
with the error message
! Argument of \MT@res@a has an extra }.
<inserted text>
\par
l.11 \end{document}
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
And the minimum working example 2:
\documentclass{report}%
\usepackage[arabic,english]{babel}
\usepackage{hyperref}
\begin{document}
\begin{figure}%
\caption{\url{http://foo.bar/baz} \label{fig_test}}%
\end{figure}%
Bild~\ref{fig_test}
\end{document}
The error messages with LaTeX for this example reads (I don't find any questionmark (?) in this):
! Extra \else.
\pdfmark@ ...space \pdf@type \space pdfmark}\else
\ltx@IfUndefined {@\pdf@li...
l.11 Bild~\ref{fig_test}
I'm ignoring this; it doesn't match any \if.
! Extra \fi.
\@setref ...@link #1\@empty \@empty \@nil {#2}\fi
l.11 Bild~\ref{fig_test}
I'm ignoring this; it doesn't match any \if.
As you may notice, both MWEs have only one thing in common: They use the babel
option arabic
. I am relatively sure, if I try a third time to get an MWE, I will end with still another one. In my eyes the option arabic
of babel
somehow seems to get in conflict with other packages, as you can see by commenting out non used packages. I am quite aware, that in both MWEs I could drop some \usepackage
's and then it would compile. But as I need those packages in my original script, it unfortunately needs to run with them...
Under PdfLaTeX (TeX Live 2019) example 1 gives error messages, example 2 compiles quite alright. Under LaTeX -- which is after the aforesaid the important case for me -- both examples produce error messages.
So meanwhile I am running out of ideas and now my question to you is: How on earth can I still use the involved packages (and a lot more, I admit) and nevertheless swap back and forth between Old Greek and Arabic -- still under good old LaTeX?
microtype
to get an error in the first case. Use\nolinkurl
in the second example. (A\url
in a\caption
is going to cause trouble regardless.)\setcode{utf8}
within a group so\ararab
definition become\newcommand\ararab[2][]{{\setcode{utf8} \RL{#2}}}
!
to?
in a code block, so line endings are preserved.