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

Vladimir Lomov lomov.vl at gmail.com
Mon Feb 17 02:03:08 CET 2014


Hello,
** mario chiari [2014-02-17 00:23:41 +0100]:

> Hi

1. IMO, this is wrong ML for such questions, texhax is a more appropriated.

> 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'?

> 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 
> **********************

> 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'.

>>> 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.

> 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 no
> t 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!

> ************************************************++

When latex typeset this document it cannot find 'metric files' (TFM). It
could generate them 'dynamically' to use them in this document and in
any other document laterly. But it can't do that while pdflatex is
running by a PHP script (don't have access I assume). When you run the
same document as root pdflatex generates these TFM files but only for
root (check /root/.texlive2010/texmf-var/fonts/tfm).

IMO, the best way to solve the issue with TFM files is to generate them
as root in /usr/local/texlive/2010/texmf-var/fonts/tfm.

There are two sample script: allcm and allec, which you can use to make
alllh, it will generate TFM for T2 fontenc, run it as root. After that copy
directory /root/.texlive2010/texmf-var/fonts/tfm to
/usr/local/texlive/2010/texmf-var/fonts/tfm . This may solve the problem
with TFM files.

> I appreciate your help
> cheers
> mario

---
WBR, Vladimir Lomov

-- 
When the Apple IIc was introduced, the informative copy led off with a couple
of asterisked sentences:

	It weighs less than 8 pounds.*
	And costs less than $1,300.**

In tiny type were these "fuller explanations":

      * Don't asterisks make you suspicious as all get out?  Well, all
	this means is that the IIc alone weights 7.5 pounds. The power
	pack, monitor, an extra disk drive, a printer and several bricks
	will make the IIc weigh more. Our lawyers were concerned that you
	might not be able to figure this out for yourself.

     ** The FTC is concerned about price fixing. You can pay more if
	you really want to.  Or less.
		-- Forbes




More information about the tex-live mailing list