Installation

Failed to convert TeX to PDF with command

Failed to convert TeX to PDF with command

by Harshal Patel -
Number of replies: 6

Hello,

I'm running Webwork 2.17 on RHEL 8. I've installed Latex and other necessary packages. I added few problems from OPL to a set, when I try to generate a hardcopy I get the following TeX errors:

---------------------------------------------------------------------

2 errors occured while generating hardcopy:

  • Failed to convert TeX to PDF with command 'cd /opt/webwork/webwork2/tmp/Test_June13/hardcopy/admin/work.oGpdfph9 && TEXINPUTS=.:/opt/webwork/webwork2/conf/snippets/hardcopyThemes/common: /usr/local/texlive/2023/bin/x86_64-linux/pdflatex --no-shell-escape >pdflatex.stdout 2>pdflatex.stderr hardcopy' (exit=1 signal=0 core=0).
  • First error in TeX log is:
    ! Extra alignment tab has been changed to \cr.
    <template> ... width\arrayrulewidth }\endtemplate 
                                                      
    l.81 \(k\) &1 &2 &3 &
                         4 &5 &6 \\ \hline
    You have given more \span or & marks than there were
    in the preamble to the \halign or \valign now in progress.
    So I'll assume that you meant to type \cr instead.
    

A hardcopy file was generated, but it may not be complete or correct. Please check that no problems are missing and that they are all legible. If not, please inform your instructor.
---------------------------------------------------------------------

It does generate a PDF file, attached, which seems fine. When I run the check_latex command (/opt/webwork/webwork2/bin/check_latex), it shows Compilation Success! message.

I found this very old post in this forum (https://webwork.maa.org/moodle/mod/forum/discuss.php?d=2514) where solution was to change the path of pdflatex. I''ve already changed the path in site.conf for $externalPrograms{latex} and $externalPrograms{pdflatex} to reflect the "/usr/local/texlive/2023/bin/x86_64-linux/" location.

Second error seems to be regarding the problem added in the set.

Also, I am able to generate hardcopy for some sets. Both the errors come up for some specific sets only, not every time. It seems like permissions issue for the first error but considering it's working most of the times, I'm not sure what to do.

In reply to Harshal Patel

Re: Failed to convert TeX to PDF with command

by Alex Jordan -

That error is just  the regular LaTeX error you would get if you tried to make a tabular where you declared 4 columns, but then tried to insert 7 columns of content. It is something bad with the code for the problem or a macro library it relies on, not something with the general webwork2 PDF construction tools. 

If you would like assistance identifying what is wrong with the problem file, please post its code and I or someone here can take a look.

In reply to Alex Jordan

Re: Failed to convert TeX to PDF with command

by Harshal Patel -
Thanks Alex, below is the code for the problem. File is '[TMPL]/Library/NAU/setLinearAlgebra/JordanBlockSizes.pg'

## DESCRIPTION
## Linear Algebra
## ENDDESCRIPTION
## DBsubject(Linear algebra) ## DBchapter(Matrix factorizations) ## DBsection(Jordan form) ## Date(11/17/2016) ## Institution(NAU) ## Author(Nandor Sieben) ## Level(4) ## MO(1)
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserMultiAnswer.pl", "AnswerFormatHelp.pl", "PGchoicemacros.pl", "MatrixReduce.pl", "rank.pl", "PGcourse.pl" ); $showPartialCorrectAnswers = 1; TEXT(beginproblem());
Context("Numeric");
$a=1; $b = $a+random(0,2,1); $c = $b+random(0,2,1); $d = $c+random(1,3,1); $e = $d+random(0,1,1); $f = $e+random(0,1,1); $answer=List($a,$b,$c,$d,$e,$f); @row1=("\( k \)"); @row2=("\( \text{nullity}(L_\lambda^k) \) "); $s[0]=0; for ($i=1; $i < 20; $i++) { $s[$i]=$s[$i-1]+($a>=$i)+($b>=$i)+($c>=$i)+($d>=$i)+($e>=$i)+($f>=$i); if ($s[$i] > $s[$i-1] ) { push @row1, "$i"; push @row2, "$s[$i]"; } }
$table_start = begintable(4); $table_row1 = row( @row1 ); $table_row2 = row( @row2 ); $table_end = endtable();
Context()->texStrings; BEGIN_TEXT Let \( \lambda \) be an eigenvalue of the linear operator \( L \) and define \( L_\lambda := L - \lambda I \). The following table lists the nullities of the powers of \( L_\lambda \). $BCENTER $table_start $table_row1 $table_row2 $table_end $ECENTER Find the sizes of the Jordan blocks corresponding to \( \lambda \) of the Jordan form of the matrix of \( L \) as a list of integers. $BR Sizes: \{ ans_rule(20) \}

END_TEXT Context()->normalStrings;
ANS( $answer->cmp() );

COMMENT('');
ENDDOCUMENT();
In reply to Harshal Patel

Re: Failed to convert TeX to PDF with command

by Alex Jordan -

You have begintable(4); starting a 4-column table. But then you give it @row1 and @row2 for rows. These rows have many more than 4 cells because of that for loop.

Change the begintable(4) to

begintable(max(scalar(@row1), scalar(@row2)))

In reply to Alex Jordan

Re: Failed to convert TeX to PDF with command

by Harshal Patel -
Thank you Alex, that worked! I am able to generate PDF now without the earlier error message, however, when I try to render this problem it shows me the following warning messages:

Warning Messages
Can't locate macro file |rank.pl| via path: |.|,
|[TMPL]/macros|,
|[PG]/macros/|,
|[TMPL]/Library/macros/Alfred|,
|[TMPL]/Library/macros/BrockPhysics|,
|[TMPL]/Library/macros/CollegeOfIdaho|,
|[TMPL]/Library/macros/Dartmouth|,
|[TMPL]/Library/macros/FortLewis|,
|[TMPL]/Library/macros/Hope|,
|[TMPL]/Library/macros/LaTech|,
|[TMPL]/Library/macros/MC|,
|[TMPL]/Library/macros/Michigan|,
|[TMPL]/Library/macros/Mizzou|,
|[TMPL]/Library/macros/NAU|,
|[TMPL]/Library/macros/PCC|,
|[TMPL]/Library/macros/TCNJ|,
|[TMPL]/Library/macros/UBC|,
|[TMPL]/Library/macros/UMass-Amherst|,
|[TMPL]/Library/macros/UW-Stout|,
|[TMPL]/Library/macros/UniSiegen|,
|[TMPL]/Library/macros/Union|,
|[TMPL]/Library/macros/WHFreeman|,
|[TMPL]/Library/macros/Wiley|,
|[TMPL]/Contrib/CAPA/macros/CAPA_Tools|,
|[TMPL]/Contrib/CAPA/macros/CAPA_MCTools|

Probably because I had to copy the locked problem from '[TMPL]/Library/NAU/setLinearAlgebra/JordanBlockSizes.pg' to 'local/Library/NAU/setLinearAlgebra/JordanBlockSizes.pg.' Though the templates folder of this course has a sym link to the OPL library and permissions are set to be 777.
In reply to Harshal Patel

Re: Failed to convert TeX to PDF with command

by Ashish Gandhi -

I have a question. I'm trying to install the UBC Docker-prod file of webwork2 on Centos7. Is there any manual for it I found only for Ubuntu 

In reply to Ashish Gandhi

Re: Failed to convert TeX to PDF with command

by Danny Glin -
Your post doesn't appear to be related to this thread. If you have a question about installation you can start a new thread with the details of your question. "UBC Docker-prod" is not part of the standard WeBWorK installation, so you will have to provide more detail about where you got it and what exactly you are trying to do.