Setting up atom with latex: local texlive


#1

I want to use atom to author .tex documents, using lualatex, komascript, polyglossia, etc. My distro has its own texlive packages, but I was instructed by another user on the latex-community forum to install the texlive distribution manually.

I’ve done that, but now I get errors when I try to run atom’s tex builder (from the latex-tools atom package), or when I try to run lualatex on the .tex file itself. I get errors like this:

(/usr/share/texmf-dist/tex/latex/xkeyval/xkeyval.sty

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.36 \NeedsTeXFormat{LaTeX2e}[
                            1995/12/01]
? ^C! Interruption.
\GenericError  ...                                
                                                  \endgroup 
l.36 \NeedsTeXFormat{LaTeX2e}[
                            1995/12/01]
? 

Obviously, something is wrong here with my setup, as it’s still using the system-wide tex distribution. How can I set up atom to run texlive from my local distribution (installed at /usr/local/tex)?

Thanks in advance!


#2

I wouldn’t recommend latex-tools, it was last updated over a year ago. I use latex instead.

In any case, the first step when something’s not working is to get it going in the command line. Are you able to compile documents directly in a terminal?


#3

Are you able to compile documents directly in a terminal?

No, I get the same errors when I run lualatex on the file directly. So something’s obviously wrong with my setup in general; I just don’t know how to fix it.


#4

addendum: when I invoke the local xelatex (ie, ‘/usr/local/tex/texlive/2017/bin/x86_64-linux/xelatex file.tex’) I get the same errors


#5

That’s not an Atom problem then; latex (the Atom package) will just use your default installation.

You could try adding the path /usr/local/tex to your PATH. Though I reccommend storing your latex stuff in your home folder, like in the following question.

Or maybe try this for configuring where TeX looks for things

It looks like you can add this to your .bashrc file

TEXINPUT=.:/usr/local/tex/:$TEXINPUTS

#6

Just guessing here, but if you did not remove your disto’s latex before you manually installed texlive, then likely the 2 tex installations are intertwined on your system and things are confused.

I suggest removing both and just installing the texlive manually.


#7

It turns out that it was a couple problems connected, both more related to latex than atom per se. But the first problem is something I can solve with correct configuration of the atom latex package: I set the texpath to my local distribution of texlive, and then it could find things.

The second issue, though, is simply that the invoice package is super-old (last update appears to be 2011), and it pukes when used in combination with, well, just about anything (polyglossia, for example).

So instead I used the much-more-recent invoice2 package, and poof! suddenly all those weird errors go away and I can get down to setting my .tex file up to work properly.

Thanks for the help. As I suspected, this is going to be a bit of a learning curve for me for a while.

Cheers


#8

In general, Atom is just a text editor. When it does something fancy, like compiling LaTeX documents, it’s really just calling the external program. That’s why the first thing to do when you have an issue with Atom not working is to get it going in the command line first.

Some things are Atom related, such as syntax highlighting, autocomplete, line folding, etc., while other things like compiling, linting, LaTeX wordcounting, and other “heavy weight” language-specific features will be using an external program to do it.