0

I have a collection of old lectures, written as .Rnw files using LaTeX beamer for presentations. They no longer compile, and I am mystified why.

Here is a minimal example, test-beamer.Rnw just trying to produce a title slide

\documentclass[10pt,table,handout]{beamer} 

%\input{inputs/beamer-setup}
%\input{inputs/defs}
\begin{document}
\SweaveOpts{concordance=TRUE}

\title[6136: Overview]{Categorical Data Analysis: Course Overview}
\author{Michael Friendly}
\institute{Psych 6136}
% insert titlegraphic
\titlegraphic{
 \rule[-4pt]{0.5pt}{4pt}\hrulefill\rule[-4pt]{0.5pt}{4pt}  \\
  \includegraphics[width=.9\linewidth,clip]{fig/bertifier} \\
  \rule{0.5pt}{4pt}\hrulefill\rule{0.5pt}{4pt} \\
}
\begin{frame}[plain]
    \titlepage
\end{frame}

\end{document}

Using the "Compile PDF" button, I get an uninformative message:

Writing to file test-beamer.tex
Processing code chunks with options ...

You can now run (pdf)latex on 'test-beamer.tex'
Running pdflatex.exe on test-beamer.tex...failed
Error running C:/Program Files/MiKTeX/miktex/bin/x64/pdflatex.exe (exit code 3)

I opened the test-beamer.tex fil in TeXstudio and tried to compile. The .log file ends with something about geometry.sty and an error from ifvtex.sty, but I cannot tell how or where ifvtex.sty is invoked. Can anyone help?

This is pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX 22.8.28) (preloaded format=pdflatex 2022.10.13)  13 OCT 2022 16:06
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**./test-beamer.tex
(test-beamer.tex
LaTeX2e <2022-06-01> patch level 5
L3 programming layer <2022-09-28>
(C:\Program Files\MiKTeX\tex/latex/beamer\beamer.cls
Document Class: beamer 2022/09/13 v3.68 A class for typesetting presentations
(C:\Program Files\MiKTeX\tex/latex/beamer\beamerbasemodes.sty
(C:\Program Files\MiKTeX\tex/latex/etoolbox\etoolbox.sty
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
....
(C:\Program Files\MiKTeX\tex/latex/beamer\beamerbaseoptions.sty
(C:\Program Files\MiKTeX\tex/latex/graphics\keyval.sty
Package: keyval 2022/05/29 v1.15 key=value parser (DPC)
\KV@toks@=\toks16
))
\beamer@paperwidth=\skip48
\beamer@paperheight=\skip49

(C:\Program Files\MiKTeX\tex/latex/geometry\geometry.sty
Package: geometry 2020/01/02 v5.9 Page Geometry

(C:\Program Files\MiKTeX\tex/generic/iftex\ifvtex.sty
Package: ifvtex 2019/10/25 v1.7 ifvtex legacy package. Use iftex instead.

! Undefined control sequence.
l.20 \IFTEX@let
               {vtexdvi}{false}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.


! LaTeX Error: Missing \begin{document}.

Follow-up: I downloaded the iftex package from the CTAN archive, installed this in my localtexmf/ directory and refreshed the database.

kpsewhich now finds both iftex.sty and ifvtex.sty

$ kpsewhich iftex.sty
C:/Dropbox/localtexmf/tex/generic/iftex/iftex.sty

friendly@UIT-HHP-9L7JNK3 MINGW64 /c/R/projects/heplots (master)
$ kpsewhich ifvtex.sty
C:/Dropbox/localtexmf/tex/generic/iftex/ifvtex.sty

Yet, when I try to compile the .tex file generated, I still get an error:

(C:\Program Files\MiKTeX\tex/latex/geometry\geometry.sty
(C:/Dropbox/localtexmf\tex/generic/iftex\ifvtex.sty
! Undefined control sequence.
l.20 \IFTEX@let
               {vtexdvi}{false}
? 

RStudio inserts the line below in the .tex file. Could this be the source of my grief?

\usepackage{Sweave}
user101089
  • 3,756
  • 1
  • 26
  • 53
  • please check if the iftex package is installed, see also https://github.com/MiKTeX/miktex-packaging/issues/137#issuecomment-549800150 – samcarter_is_at_topanswers.xyz Oct 13 '22 at 21:10
  • Thanks for this helpful link. Yes, the MikTeX 2.9 package manager shows I have `iftex.sty`, dated 2022-02-07 installed by Admin. I am getting a similar error on another machine (Win 10), and it occurs just after `geometry.sty` is loaded. – user101089 Oct 14 '22 at 17:11

1 Answers1

1

No one answered, so here is what I've done that works now.

  • Copied iftex.sty and ifvtex.sty to the local directory of my source .Rnw files. No idea why this was necessary, but perhaps this item about MikTeX paths is relevant: Set path to miktex for pdflatex in R

  • Still had problems with MikTeX, so I switched to tinytex via R Stidio Tools -> Global options -> Sweave -> Use tinytex when compiling .tex

user101089
  • 3,756
  • 1
  • 26
  • 53