[tex-live] OT2 vs. T2A; compilation by apache user issues

Robin Fairbairns Robin.Fairbairns at cl.cam.ac.uk
Mon Feb 17 09:26:32 CET 2014


Vladimir Lomov <lomov.vl at gmail.com> wrote:

> ** mario chiari [2014-02-17 00:23:41 +0100]:
> 
> 1. IMO, this is wrong ML for such questions, texhax is a more
> appropriated.

i would recommend tex.stackexchange.com (but read the intro first)

i wouldn't recommend texhax, but one does occasionally see a useful
answer there; tex/sx (as it calls itself) has a far better "hit rate",
ime

> > thanks for the reply.
> 
> > On Sun, 2014-02-16 at 16:53 +0100, Zdenek Wagner wrote:
> >> 2014-02-15 19:03 GMT+01:00 mario chiari <ml at mariochiari.net>:
> > ....
> 
> > Question A:
> 
> >>> I use
> >>> \usepackage[OT2,T1]{fontenc}
> >>> \usepackage[american,russian,italian]{babel}
> > \usepackage[utf8]{inputenc} too
> >>> and define:
> >>> \newcommand\cyrillic{%
> >>> \renewcommand\rmdefault{wncyr}%
> >>> \renewcommand\sfdefault{wncyss}%
> >>> \renewcommand\encodingdefault{OT2}%
> >>> \normalfont
> >>> \selectfont}
> >>> \DeclareTextFontCommand{\textcyr}{\cyrillic}
> 
> IMO, over-complicated approach. If you know that Russian text (or
> Cyrillic in general) always will be in UTF-8 encoding then you only need
> fontent with T2A option (but be aware that T2A fits Ok only for Russian)
> and inputenc with utf8 option. AFAIU, OT2 is needed when only ASCII
> encoding is available (then one has to use commands for Russian/Cyrillic
> letters in a document).
> 
> >>> Everything works fine, but when I need something like
> >>> \section{\textcyr{}}.
> 
> >>> So, my first question, how do I fix that?
> 
> >> WHAT do you want to fix? How can we help without seeing the log?
> 
> > I need to fix why \textcyr{Коминтерн} gives weird results when within a
> > \section{}. If \textcyr does not occur within \section (and similar)
> > everything runs fine.
> 
> The question is: why you use OT2? Why not fontenc with T2A and
> inputenc with 'utf8'?

if you're stuck with latex (as opposed to xelatex) that's the way to go.

> > Here the relevant log portion:
> > *******************
> > LaTeX Font Info: Try loading font information for OT2+wncyr on input
> > line 2.
> 
> > (/usr/local/texlive/2010/texmf-dist/tex/latex/cyrillic/ot2wncyr.fd
> > File: ot2wncyr.fd 1999/12/17 v3.2a Computer Modern Cyrillic font
> > definitions
> > )
> > ! Argument of \@sect has an extra }.
> > <inserted text> 
> >                 \par 
> > l.2 \section{\textcyr{Коминтерн}}
> 
> > 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?
> > {\normalfont \Large \bfseries }\relax \ifx \reserved at b \@let at token
> > \@tempswafal
> > se \ETC.
> > ! Paragraph ended before \@sect was complete.
> > <to be read again> 
> >                    \par 
> > **********************

fragile argument in moving argument.

> > Question B:
> 
> >>> I have hacked from a forum a different setting:
> >>> \usepackage[T2A,T1]{fontenc}
> > \usepackage[utf8]{inputenc} too
> >>> \DeclareRobustCommand{\textcyr}[1]{\foreignlanguage{russian}{#1}}
> 
> Why you re-invent the wheel? Just add to document preamble
> \usepackage[american,russian,italian]{babel}
> and use macro '\textcyrillic'.

\textcyrillic is a robust command

> >>> The latter works fine too, as long as I run pdflatex from my
> >>> command line as user root.  However I need to create and compile a
> >>> .tex file from within a php script, and then compilation partly
> >>> fails, cyrillic characters are not rendered.  I understand that
> >>> that is because the apache user launches the process:
> 
> >> Where is the environment defined and how? Apache does not know the
> >> complete PATH, see the setting of PassEnv and SetEnv directives in
> >> the Apache manual.
> >
> > Do I really need to look at Apache configuration? Apache works fine when
> > I define \textcyr as above, question A.
> 
> Yes, because root has access to any file and directory while a PHP
> script running in Apache has very limited access.
> 
> >> How do you handle conversion of cyrillic to a latin transliteration in
> >> PHP? do I? 
> >> Are you sure the bug is not in the PHP script? 
> >
> > Almost Yes: PHP produces a .tex file (using data from a mySQl table). If
> > I compile it by myself (as root), pdflatex compiles it fine. The issue
> > is when pdflatex is called from a PHP script (as apache).
> 
> >> shouldn't it be
> >> better to require direct entry of cyrillic in UTF-8 and pass it
> >> directly without any conversion to XeLaTeX? You can then either change
> >> the font per language using Polyglossia or per Unicode block by
> >> ucharclasses.
> 
> IMO, this was a suggestion to improve your current workflow. You didn't
> told any details of your problem, do you use one, two or three languages
> in your documents, what encoding of documents, what fonts are
> available...
> 
> >>> apache  /usr/local/texlive/2010/bin/i386-linux/pdflatex --interaction
> >>> batchmode  myfile.tex
> 
> >>> I am a newbie about this kind of issues, so my second question is:
> >>> how do I fix that user issue?
> 
> >> Again, without seeing the log no one can guess what happens on your computer.
> 
> > relevant log portion seems to be the following
> > ***************************************
> > LaTeX Font Info:    Try loading font information for T2A+lmr on input
> > line 2.
> > LaTeX Font Info:    No file T2Almr.fd. on input line 2.

this is to be expected: latin modern (default mode) doesn't do cyrillic.

> > LaTeX Font Warning: Font shape `T2A/lmr/bx/n' undefined
> > (Font)              using `T2A/cmr/m/n' instead on input line 2.
> 
> > ! Font T2A/cmr/m/n/17.28=larm1728 at 17.28pt not loadable: Metric (TFM)
> > file not found.
> > <to be read again> 
> >                    relax 
> > l.2 \section{\textcyr{Коминтерн}.}
> 
> > I wasn't able to read the size data for this font,
> > so I will ignore the font specification.
> > [Wizards can fix TFM files using TFtoPL/PLtoTF.]
> > You might try inserting a different font spec;
> > e.g., type `I\font<same font id>=<substitute font name>'.
> 
> > Missing character: There is no \CA in font nullfont!
> > Missing character: There is no \EE in font nullfont!
> > Missing character: There is no \EC in font nullfont!
> > Missing character: There is no \E8 in font nullfont!
> > Missing character: There is no \ED in font nullfont!
> > Missing character: There is no \F2 in font nullfont!
> > Missing character: There is no \E5 in font nullfont!
> > Missing character: There is no \F0 in font nullfont!
> > Missing character: There is no \ED in font nullfont!

this lot tells you that you carried on after failing to select a font
(nullfont is a "non-font", used for this purpose only when you press on
after the failure to select in the first place).

in short, the whole setup needs redesigning.

we can't give more than hints here, since we don't know how your system
is set up.  (fwiw, for the tex faq, i don't run tex in the server;
everything that needs tex compilation is done statically and the results
are delivered by the server.  my setup precedes the invention of php (i
think).

r




More information about the tex-live mailing list