I am trying to set up a latex environment for usage with RMarkdown that doesn't use up too much space and found this great repo.
I installed following the "for R Users" instructions at the documentation but I can't knit a RMarkdown document. I get the following error:
pandoc: pdflatex not found. pdflatex is needed for pdf output.
Error: pandoc document conversion failed with error 41
Execution halted
No TeX installation detected (TeX is required to create PDF output). You should install a recommended TeX distribution for your platform:
. Linux: Use system package manager
which points me to install the "more traditional" tex distributions, which is what I wanted to avoid in the first place. Or do I need to, at least, have a minimal tex distro installed?
(p.s.: this is the first issue I open, please indicate any mistakes I might have committed)
Which Linux distro are you using?
thanks for the reply, i am using ubuntu 17.10. To be more especific, the output of uname -a is:
Linux t420s 4.13.0-25-generic #29-Ubuntu SMP Mon Jan 8 21:14:41 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Interesting. Ubuntu should be fine, unless something changed about PATH in 17.10. Could you tell me the output of echo $PATH in your terminal? And also Sys.getenv('PATH') from R. In theory, it should contain $HOME/bin.
echo $PATH
/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /home/avila/miniconda3/bin/
Sys.getenv('PATH')
[1] "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/avila/miniconda3/bin/"
in the meantime (probably unfortunately) I did get it working by installing a not-so-big-not-so-small texlive distribution.
In any case, installing still missing latex packages from within R through tinytex worked great!!
((I would be willing to delete the texlive distro in order to troubleshoot this issue, if you deem it to be important))
So $HOME/bin (i.e. /home/avila/bin) was missing in your PATH. Does it exist? If it does, check ls -l ~/bin in your terminal and see if there are symbolic links.
According to this anser https://unix.stackexchange.com/a/215717, $HOME/bin should be automatically added to PATH on Ubuntu.
I wonder how /home/avila/miniconda3/bin/ was added to PATH, and I believe $HOME/bin can be added in the similar way.
Thanks for your time and patience.
After some looking around, the root of the problem seems to be related to the fact that I am using fish shell instead of bash. It is probably not configured properly, because I do get the $HOME/bin included in the PATH variable when calling it from bash shell.
avila@t420s:~$ echo $PATH
/home/avila/bin:/home/avila/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/avila/miniconda3/bin/
I suppose If I either use bash or properly configure fish, it should work as expected.
I see. Does Sys.getenv('PATH') in R (RStudio) include $HOME/bin?
Don't worry about my time. Actually I want to get this resolved, because it may also affect other Linux users. This PATH thing is currently my only concern in tinytex.
Ok. Before restarting the system:
$HOME/bin was NOT included in Sys.getenv('PATH') calling from R (no matter if R was invoked from bash, fish or RStudio.
$HOME/bin was also NOT included if calling echo $PATH from the built in shell within RStudio
after restart:
$HOME/bin IS included in Sys.getenv('PATH') calling from R (invoked from bash, fish or RStudio), and also from the built in shell in RStudio, when calling echo $PATH. Strangely, when calling from the terminal within RStudio, some values appear repeatedly (more repeatedly than previously, where ..miniconda3/bin... appeared twice, for instance... )
EDIT/continuation: this time it appeared 4 times. And there are some added SSH "stuff", but this is probably unrelated to this issue.
(FROM RSTUDIO) $ echo $PATH
/home/avila/bin:/home/avila/bin:/home/avila/miniconda3/bin:
/home/avila/miniconda3/bin:/home/avila/miniconda3/bin:
/home/avila/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:
/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:
bin/msys-ssh-1000-18:bin/msys-ssh-1000-18:bin/msys-ssh-1000-18:
bin/msys-ssh-1000-18:bin/msys-ssh-1000-18:bin/msys-ssh-1000-18
Great. It seems one may have to restart the system after installing TinyTeX.
I don't think the repeated items in PATH could cause any problems. RStudio might have read them from .profile and added them again to PATH. I'm not sure.
Now if you remove Ubuntu's official texlive packages and restart RStudio, does RStudio still complain about the missing LaTeX distribution?
does RStudio still complain about the missing LaTeX distribution?
No, it doesn't! 馃憤 Thank you very much for your support and time
P.S: I followed the steps from this question on Stack Exchange to completely remove texlive.
Excellent! I'm glad we figured it out. I'll add a note in the documentation.
Just in case if you are on windows, perhaps in corp-restricted environment, your best bet would be to use tinytex package tools. Installing the tinytex R package by itself is not sufficient. You will have to install TinyTeX, the LaTeX distribution. If you have already installed the R tinytex package, run tinytex::install_tinytex().
You can find more information from YiHui.
Most helpful comment
Just in case if you are on windows, perhaps in corp-restricted environment, your best bet would be to use tinytex package tools. Installing the
tinytexR package by itself is not sufficient. You will have to installTinyTeX, the LaTeX distribution. If you have already installed the Rtinytexpackage, runtinytex::install_tinytex().You can find more information from YiHui.