2

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?

12
  • 2
    Please provide a link to your previous question, as it's related, and include the text of the error messages you get for your examples. You don't need 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.)
    – cfr
    Nov 28, 2019 at 3:46
  • I would be interested in seeing if Hebrew causes the same issue you encounter with Arabic. Both of these languages write from right to left--the opposite of European languages.
    – Polyhat
    Nov 28, 2019 at 5:50
  • For the first example you need to include \setcode{utf8} within a group so \ararab definition become \newcommand\ararab[2][]{{\setcode{utf8} \RL{#2}}}
    – Salim Bou
    Nov 28, 2019 at 7:42
  • if you want help with an error message please show the exact error message from the log file, from ! to ? in a code block, so line endings are preserved. Nov 28, 2019 at 7:46
  • Hello cfr, thank you and all the others for your help! I edited my original post to add the link to my former post (tex.stackexchange.com/questions/517885/…). I saw, that I don't need microtype. But with me the contents of the error message changes, if I comment that line out, so somehow it interferes as well -- and I use it in my original script, so it should work...With the other comments and answers I can only deal, when I am back on my computer, which will take some hours...
    – ThorstenL
    Nov 28, 2019 at 14:34

1 Answer 1

1

General remark

Language option files like arabic are normally not part of the core babel but provided by other people. arabic.ldf (and the styles it loads) is very old, from 2006 and seems to be unmaintained.

The same can be said for arabtex: The date says that the last change is from 2003.

Both are very heavy packages which patch and change a lot commands. This makes them very fragile. Every change in some other package or your setup can break your document - and if it breaks there will be nobody to fix them.

So if you have a large, complicated document which works, keep your fingers away from the update button.

Details

Your first example compiles again if you add a brace group in the \ararab definition, so that the \setcode command doesn't affect the following code. Loading inputenc is not necessary in a current texlive.

\documentclass{report}
\usepackage[LGR,T1]{fontenc}
\usepackage[greek,ngerman]{babel}
\usepackage{arabtex}
\usepackage{utf8}
\newcommand\ararab[2][]{{\setcode{utf8}\RL{#2}}}

\begin{document}

\foreignlanguage{greek}{Παίδων τοίνυν ἡμῶν ὅντων καθαιρεῖ μὲν τὸν}

\ararab{أبو علي الحسن بن الهيثم}

\foreignlanguage{greek}{Παίδων τοίνυν ἡμῶν ὅντων καθαιρεῖ μὲν τὸν}

\end{document}

Your second example fails as \thispagestyle{plain} redefines \thepage to

\gdef\thepage{\protect\if@rlmain\protect\I{\number\c@page}%
              \protect\else\protect\textLR{\number\c@page}

mparhack uses \thepage in the output routine to store labels and doesn't like this redefinition at all (your example would fail without microtype too).

Your last example fails for a similar reason: arabic redefines \thefigure as

\def\thefigure{\protect\if@rl\protect\I{\number\c@figure.\number\c@chapter}%
\protect\else\protect\textLR{\number\c@chapter.\number\c@figure}%
\protect\fi}

This leads in the aux to labels like this

 \newlabel{fig_test}{{\if@rl \I {1.0}\else \textLR {0.1}\fi }{1}{\url {http://foo.bar/baz}}{figure.0.1}{}}

and in dvi mode hyperref can't cope with it (in pdf mode it passes).

I'm not sure if there are good work-arounds.

4
  • Hello Ulrike, I already often admired your answers, when I was not yet an active member of this forum, but in the read-only-status... ;-))) As an Engineer I normally follow the rule "never change a running system!" So normally I change my LaTeX Version only about every five years -- I just had done that last year. But the only thing I altered now to open a can of worms was, that I put some greek text behind the arabian one -- and then my system wouldn't work any longer! But the greek text simply had to stay there -- and so I began to search for alternatives...
    – ThorstenL
    Nov 29, 2019 at 1:26
  • ... I already had read, that ArabTeX last had been changed in 2003 (when I began writing). But I had read, that babel just recently had taken up development again, and so mistakenly thought, that the option arabic might be a much more recent solution than ArabTeX. I am happy to learn from you, that I was wrong with that (though I am not happy, that I was wrong with that... ;-))) ). Your and Salim Bou's proposal, to add brackets to my macro \ararab{} seems to help, the greek stuff behind the Arabic now looks quite ok to me. So probably in future I will stay with good ol' ArabTeX...
    – ThorstenL
    Nov 29, 2019 at 1:35
  • In the moment I have a new error message though, but nearly 1000 pages away from all the Arabic and Greek stuff, hidden deep inside a very big macro of my own, so my search for the cause may very well take quite some time. I think, that has nothing to do with the current problem, perhaps it vanishes, if I go back to TeXLive2018... So thank you all, who tried to help me, I will stay with ArabTeX and double braces in the macro ararab, perhaps going back to TeXLive2018...
    – ThorstenL
    Nov 29, 2019 at 1:42
  • Found the mistake leading to the new error message myself already -- sometimes my fingers are quicker than my brain, whoever of both is to blame for that... so everything ok now with ArabTeX!
    – ThorstenL
    Nov 29, 2019 at 2:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .