I am creating cards with tasks in tex format. Card sample


Карточка №1
\begin{equation*}\text{Решите уравнение}\space \log_{9}{(4x+5)}=5           \end{equation*} \\ 
\begin{equation*}\text{Решите уравнение}\space \log_{4}{(4x+(-1))}=4 \end{equation*} \\ 
\begin{equation*}Решите\space уравнение\space \log_{2}{(1x^2+(-2))} = \log_{2}{6x} \end{equation*} \\ 
\begin{equation*}\text{Решите уравнение}\space \log_{4}{x} = 5 \end{equation*} \\ 
\begin{equation*}\text{Решите уравнение}\space \log_{7}{x} = 2 \end{equation*} \\ 

When I compile this file via shell_exec in PHP, resulting PDF doesn't have any letters, just formulas. But, if I run /usr/bin/pdflatex -output-directory /var/www/files --interaction batchmode 2016-06-15.00-30-46576031369d029.tex in console, PDF will contain symbols.

What can cause this problem?

  • Perhaps your php and shell is not using the same latex installation. Look in their log files. Btw: are you sure utf8x and us should be used and not just utf8? – daleif Jun 14 '16 at 17:32
  • @daleif nope, in php I execute same command. Just looked at log files and I think this is the cause ! Font T2A/lmr/m/n/10=larm1000 at 10.0pt not loadable: Metric (TFM) file not found. – Rulisp Jun 14 '16 at 17:44
  • 2
    The www user (or whatever is used by PHP) has no “personal tree” where storing the TFM files for Cyrillic fonts. When you do it from your personal account, they are written under ~/.texmf – egreg Jun 14 '16 at 17:49
  • @egreg is there any way to bypass it? Switch php user ? – Rulisp Jun 14 '16 at 17:52
  • 1
    You have somehow to make the tfm available files in the “global” directories. – egreg Jun 14 '16 at 17:58

As a temporary workaround, I finish with this

$output = system("echo 'pass' | sudo -u user /usr/bin/pdflatex -output-directory /var/www/files --interaction batchmode files/".$name.".tex");

  • 3
    That is really bad, you definitely need to figure out why your php user does not see the proper path. Have you examined the paths used when executing the php. – daleif Jun 14 '16 at 18:16
  • 1
    Can you please put the log files of the two runs up somewhere? It is absolutely impossible to guess what is going on without the log files – norbert Jun 15 '16 at 9:27
  • Also, which -a pdflatex will help. – Paulo Cereda Jul 14 '16 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.