Something terrible has happened to tinytex on my machine

This started as me writing an issue on the tinytex GitHub, but as I have tried to troubleshoot it, I keep finding more and weirder errors.

Here's the big-picture goal: I want to get my LaTeX CV to compile nicely using RStudio. I've used tinytex for years within RStudio rather than maintaining another TeX installation, and it has been fine for a long time. My CV is available as a gist if you'd like to check the LaTeX code, but I swear I have not edited it since it last successfully compiled, in June.

When I went to compile it today, it creates a PDF document but it looks awful. The major problem is that all the text in the document is bold. I do get one warning,

Package auxhook Warning: Cannot patch \document,
(auxhook)                using \AtBeginDocument instead.

I've gone down a rabbit hole on StackExchange about this warning, because my document does not explicitly use auxhook, but it does use a resume.cls file, which may be the problem. The file I used is a lightly-modified version of Trey Hunter's file, and it requires a few packages.

"Ah!" I said. "Maybe those packages are missing." I tried installing them.

> tlmgr_install(pkgs = "ifthen")
tlmgr install ifthen
tlmgr install: package ifthen not present in repository.
tlmgr: action install returned an error; continuing.
tlmgr: package repository https://mirror.mwt.me/ctan/systems/texlive/tlnet (not verified: gpg unavailable)
tlmgr: An error has occurred. See above messages. Exiting.
tlmgr update --self
tlmgr install ifthen
tlmgr install: package ifthen not present in repository.
tlmgr: action install returned an error; continuing.
tlmgr: package repository https://ctan.math.utah.edu/ctan/tex-archive/systems/texlive/tlnet (not verified: gpg unavailable)
tlmgr: An error has occurred. See above messages. Exiting.

Same deal for another package I needed, array. At this point, I'm digging into the issues on tinytext. I find a related one, but the resolution to that was that the package didn't exist on CTAN. Both array and ifthen exist on CTAN. I start writing a new GitHub issue.

I get down to Yihui's checkboxes at the bottom of the issue box, where he asks you to certify you've done a couple things. One is provide the session info,

> xfun::session_info('tinytex')
R version 4.2.1 (2022-06-23)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: , RStudio 2022.7.1.554

Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8

Package version:
  graphics_4.2.1  grDevices_4.2.1 stats_4.2.1     tinytex_0.40    tools_4.2.1     utils_4.2.1    
  xfun_0.32      

LaTeX version used: 
  TeX Live 2022 (TinyTeX) with tlmgr 2022-04-18

Another is verify that you've tried updating everything. So I update R, reinstall RStudio (looks like that hadn't changed since I last installed), reinstall my packages, including tinytex. Same issue when I'm trying to compile. Then Yihui says you need to try the development version of tinytex.

> remotes::install_github('rstudio/tinytex')
Downloading GitHub repo rstudio/tinytex@HEAD
Running `R CMD build`...
* checking for file ‘/private/var/folders/8d/qbk26svn0f74ygywvkrd70lr0000gn/T/RtmplpsbmS/remotes161df122229b4/rstudio-tinytex-3d146ac/DESCRIPTION’ ... OK
STDOUT:
* checking for file ‘/private/var/folders/8d/qbk26svn0f74ygywvkrd70lr0000gn/T/RtmplpsbmS/remotes161df122229b4/rstudio-tinytex-3d146ac/DESCRIPTION’ ... OK
STDERR:
Error in system2("cp", "--version", stdout = TRUE, stderr = FALSE) : 
  error in running command
Execution halted
sh: rm: command not found
Error: Failed to install 'tinytex' from GitHub:
  Failed to `R CMD build` package, try `build = FALSE`.

sh: rm: command not found?? That doesn't sound good. But okay, I'll try build=FALSE.

> remotes::install_github('rstudio/tinytex', build=FALSE)
Downloading GitHub repo rstudio/tinytex@HEAD
* installing *source* package ‘tinytex’ ...
sh: mv: command not found
Warning in system(paste("mv -f ", shQuote(instdir), shQuote(file.path(lockdir,  :
  error in running command
ERROR: cannot remove earlier installation, is it in use?
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/tinytex’
sh: rm: command not found
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/8d/qbk26svn0f74ygywvkrd70lr0000gn/T//RtmplpsbmS/remotes161df70644e57/rstudio-tinytex-3d146ac’ had non-zero exit status

:sob::sob:

At this point, I have no idea what my problem is. Is it:

  • There's some goofy error in my LaTeX document
  • The rm command somehow doesn't work? (It works in the Terminal)
  • My TeX installation is corrupted
  • I need to specify my CTAN repository more explicitly
  • Small aliens have taken up residence in my computer
  • ???

What stood out to me what that your os is a MacOS.
I googled around that; thus website suggests checking your $PATH.

Fixing “Command Not Found” Terminal Messages in Mac OS with $PATH Setting

The most likely reason why Mac users may unexpectedly see the command not found message in the command line is something went awry with the users $PATH, or the path where the command is located is not set. You can check the $PATH with “echo $PATH” if you feel like it, otherwise you can just run the following commands to set the standard default path that Mac OS uses in the command line:

export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Ah, this is a promising avenue! I have struggled with PATH issues before, and probably messed mine up trying to debug a ruby/jekyll issue a few weeks ago. Here's my current PATH:

> Sys.getenv("PATH")
[1] "/Users/amcnamara2/miniconda3/bin:/Users/amcnamara2/.gem/ruby/X.X.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/amcnamara2/miniconda3/bin:/Users/amcnamara2/miniconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/amcnamara2/Applications/quarto/bin:/Library/TeX/texbin:/usr/texbin:/Applications/RStudio.app/Contents/MacOS"

Well THAT doesn't look right!

Running export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" in the terminal doesn't seem to make a difference to this, which probably means I have done something stupid elsewhere. My .Renviron file had one little PATH-related thing, which I've deleted and saved and I restarted R. Sys.getenv() still gives that long path with miniconda in it a bunch of times.

BUT searching on RStudio Community brings up this thread which suggests there is perhaps a bug in the RStudio IDE related to PATHs and Mac M1? Sigh. More to explore.

Fixed my PATH! Now I can install tinytex from GitHub.

I still can't install the ifthen or array LaTeX packages with tlmgr_install(), and my document still compiles with everything in bold, but I've at least reduced the number of weird things going on.

(restored deleted comment because it probably doesn't hurt)

I assume you have to find all the files (can) that set the PATH on shell startup, like .bashrc, .bash_profile, .profile etc. depending on your shell (maybe .zshrc? macOS switched to zsh as the default shell, right?). If you recently dealt with ruby/python PATH stuff you took note on which changes you made where, right?
Right? :grimacing:
(A lesson I learned far too late myself)

Running conda init <shell> typically changes the appropriate startup file and adds
itself to the PATH for reasons that many people often want, and others are caused many headaches by.
(Many headaches were caused for me, yes.)

Changing the PATH in the terminal interactively however will not do much since RStudio will most likely refer to whatever startup files (.profile etc) say about your PATH.

Another PATH headache to look out for: If you use homebrew on an M1 mac, it will be located in /opt/homebrew rather than the place in /usr/local where it used to be before, so if you want your RStudio installation to find homebrew-installed things, that'll need to be accounted for.

That being said: Dealing with ruby, python and R-related PATH issues in short succession is just rough.
I'm so sorry. Best of luck!
(I've been there, I hate it)

Oh no, you should have left it! When I say "fixed my PATH" I mean "it sort of works now," not "I know what's going on with it."

Back to my highest-level problem, getting my document to compile without being all bold. I have verified that if I compile the same document on Overleaf, it is not all bold. So it's definitely something related to my LaTeX installation on this computer. Not clear if PATH issues could be at fault, although now I want to blame them for everything.

If you still can't install the packages via tlmgr_install - I assume it's the same error message about e.g. mv or rm not found, or is it something different? Because in that case there's still PATH-shenanigans going on :thinking:

As for tinytex - you reinstalled the R package / updated to the dev version, but did you also remove the actual tinytex installation? I forgot exactly where they put it on macOS, I think $HOME/Library/Application Support maybe? Anyway, maybe nuking the tinytex folder from orbit and reinstalling it via the tinytex R package gives you a clean slate?

The next best thing I can think of if the issue is that packages on CTAN aren't found is mirrors - you kind of like having a CRAN mirror set that happens to have a bad day or something, and switching to another one fixes it (okay, back before everyone was using RStudio's mirror (or RSPM (or Dirk Eddelbuettels Ubuntu repo for R (or whatever else)).
I know too little about CTAN but Idunno, might as well put it at the bottom of the checklist.

...But probably the tinytex deletion/reinstallation is more promising. I think. maybe?

Addendum: TinyTex installs to /Users/<you>/Library/TinyTeX on macOS.

Oh, another PATH related hail mary: Juuuust in case, move your user .zshrc or any other file you may have modified (like .profile ? Idunno. Dotfiles in $HOME that aren't mission critical and may have been modified in the past months) to backup copies (so you can easily restore them), e.g. to .zshrc_bak or something - and restart your R session / RStudio to check if anything changes, or breaks in interesting ways, or does not change.
It's a process of elimination to at least check that file XYZ isn't being a poopypants :person_shrugging:

Okay, I copied your CV .tex file and copied the original resume.cls file in the same folder, rendered with RStudio's "Compile PDF" button via tinytex, and got an all-bold document.

This is a multiplayer game now!

I am also seeing

#> tinytex::tlmgr_install("ifthen")
tlmgr install ifthen
tlmgr install: package ifthen not present in repository.
tlmgr: action install returned an error; continuing.
tlmgr: package repository https://packages.oth-regensburg.de/ctan/systems/texlive/tlnet (verified)
tlmgr: An error has occurred. See above messages. Exiting.
tlmgr update --self
tlmgr install ifthen
tlmgr install: package ifthen not present in repository.
tlmgr: action install returned an error; continuing.
tlmgr: package repository https://packages.oth-regensburg.de/ctan/systems/texlive/tlnet (verified)
tlmgr: An error has occurred. See above messages. Exiting.

Addendum:

Possibly but maybe not related: Your .tex uses a reSubsection, presumably distinct from the rSubsection environment defined in resume.cls, but reSubsection isn't defined in that class file :thinking:
It's most likely not related to the package installation issue, but could be a reason for borked formatting? Then again, I assume your light modifications to resume.cls include having added that environment maybe?

Addendum #2 (Electric Boogaloo):

I dug into it a little more, by reducing down the .tex file to a barebones header + 1 section + footer (an MWE/reprex would probably be cool), and noticed the environment definitions in resume.cls:

% Used to create large resume section
\newenvironment{rSection}[1]{
  \sectionskip
  \MakeUppercase{\bf #1}
  \sectionlineskip
  \hrule
  \begin{list}{}{
    \setlength{\leftmargin}{1.5em}
  }
  \item[]
}{
  \end{list}
}

% Used to format job listing
\newenvironment{rSubsection}[4]{
  %%%%%%%%%%%%%%%%%%%%%% Default Layout: %%%%%%%%%%%%%%%%%%%%%%%%
  %%    Employer (bold)                     Dates (regular)    %%
  %%    Title (emphasis)                Location (emphasis)    %%
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  {\bf #1}                 \hfill                  {    #2}% Stop a space
  \ifthenelse{\equal{#3}{}}{}{
  \\
  {\em #3}                 \hfill                  {\em #4}% Stop a space
  }\smallskip
  % \cdot used for bullets, items non-indented
  \begin{list}{$\cdot$}{\leftmargin=0em}
  \itemsep -0.5em \vspace{-0.5em}
}{
  \end{list}
  \vspace{0.5em}
}

both use {\bf ...}at least once, and right now, my best guess is that there's somehwere a missing } that goes unnoticed, or that maybe there's an \item missing where one should be (because that's one of the errors I got along the way):

! LaTeX Error: Something's wrong--perhaps a missing \item.

Or that there's an {} in the section headings too many or few, see e.g.

\begin{rSubsection}{R for Data Science Faculty Learning Community}{}{Spring 2022}{Faculty leader}

Because rSubsection needs 4 args, but maybe you missed one heading where there's too few or many args given, or an interaction effect of both, I'm not sure.

I even switched fonts to make sure it's not a font issue that somehow... I don't know what, I just know that fonts are of the devil.

Only thing I know is that a greatly reduced version of the file renders fine(ish)

..and that LaTex and the bajillion packages/scripts/whatever that hold it together is very bad at error messages, because one issue at one place can finally cause an error for something 371 steps down the line and you'll google your fingers raw.
This isn't a personal vendetta I swear.
Okay maybe.

Anyway, my current suggestion is: Start with an empty .tex file and copy everything above \begin{document}.
Then add a single section and see what happens.
Then maybe the next one.
Continue until you're considering just rewriting the whole thing in {pagedown} or Quarto.

And if you get an error about no .aux files being allowed, add \let\nofiles\relax before \begin{document} or comment out the \nofiles line in resume.cls.
Just in case that one comes up, because it sure did for me :sweat_smile:

As for the package installation thing: I don't think that's the root problem and even though I had the same error message I was able to install other packages just fine just now. I think that's spurious.

There are some LaTeX issues in your gist, which I've addressed in mine.

  • Need to load the {url} package
  • The {lastpage} package breaks compilation
  • Some of the {rSubsection} blocks were coded {reSubsection} or {esSubsection}
  • {rSubsection} works like {enumerate} and takes \item

This compiles under Ubuntu Gummi (a lightweight tex editor. It should also compile ok under tinytex, but I haven't tried it on macOS.

The

message is a misdirect. It's only a warning.

Debugging tex is hard for people, like me, who don't use it all the time. What I did was to start with Trey's example, confirmed that it compiled, then cut and pasted your gist in sections until something broke. Repeat.

Thanks, folks! I apologize to those I nerd-sniped with this issue. I still have a bunch of weird PATH stuff going on with my machine (whatever I did to try to set up ruby/jekyll a few weeks ago was not successful) but that doesn't seem to be the root issue here.

Neil Brown on twitter identified the issue causing everything to be bold-- a \bf that was in the wrong spot. My CV now compiles nicely! The \reSubsection and \sSubsections were my own addition to try to have some variety (I made them years ago, no current recollection why). They are in my version of the .cls file. What I still don't understand is why that errant \bf was not bolding everything in June, when I compiled the exact same .tex document with the same .cls. Must be some fallback thing in LaTeX somewhere, maybe related to versioning.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.