texlab
texlab copied to clipboard
Where are the compilation errors?
Thanks so much for the great project.
Attached is the image of my emacs session, trying to compile the simple code at the left, which has an unkown command that should produce an error. The right panel shows the texlab session. The bottom panel should show the erros of compilation; it does not.
Any advice?
Thanks for the kind words :).
The bottom panel should show the erros of compilation; it does not.
How did you compile main-paper.tex
? Did you change the output directory of the auxiliary files or is the log file inside the same directory as the TeX file? Can you paste or attach the log file here, please?
Thanks for reply.
It seems that I had a .cache
problem (since I am new to spacemacs
). I solved aggressivley by removing the .cache
directory. Now, other related problems merge.
- texlab erros that should appear automatically in the
.tex
buffer do not show automatically after saveing or while editing. - the bottom pannel does not update consistantly.
I wasted a lot of time trying configuing things, although spacemacs
should run out of the box. For helping, I have this in my .spacemacs
file:
(setq lsp-latex-build-is-continuous t
lsp-latex-chktex-on-edit t
lsp-latex-forward-search-after t
;; lsp-latex-forward-search-args '("--eval" "(lsp-latex-forward-search-with-pdf-tools \"%f\" \"%p\" \"%l\")")
;; lsp-latex-forward-search-executable "emacsclient"
;; lsp-latex-build-args '("--shell-escape" "-preview_continuous_mode" "-pdf" "-interaction=nonstopmode" "-synctex=1" "%f")
)
texlab erros that should appear automatically in the .tex buffer do not show automatically after saveing or while editing.
texlab
requires a recent build log to update the errors and warnings. To provide a list of diagnostics, a compilation is needed due to the nature of TeX and texlab
is not a TeX engine so it has to let the actual TeX engine do the work. It should automatically update the diagnostics whenever the log changes.
Regarding your config: lsp-latex-build-is-continuous t
is not needed anymore as this property has been made obsolete in 3.2.0. For the other properties, I recommend the following page: https://github.com/latex-lsp/texlab/blob/master/docs/previewing.md
In particular, -preview_continuous_mode
does not play nicely with forward search.
Thanks so much; your answer raises some questions:
texlab erros that should appear automatically in the .tex buffer do not show automatically after saveing or while editing.
texlab
requires a recent build log to update the errors and warnings. To provide a list of diagnostics, a compilation is needed due to the nature of TeX andtexlab
is not a TeX engine so it has to let the actual TeX engine do the work. It should automatically update the diagnostics whenever the log changes.
- I agree; however, when I compile, the bottom panel does not refresh deterministically. I mean some times refreshes and sometimes it keeps empty. The behaviour is not deterministic! I wasted a lot of time trying solving that. BTW, I installed
texlab
via archlinux distro:yay -S texlab
, and emacs shows that it callstexlab2
. Is this relevant?
EDIT I think the problem is that texlab
error buffer (the bottom panel) does not refresh. When I open another latex file it keeps looking at the previous one!
Regarding your config:
lsp-latex-build-is-continuous t
is not needed anymore as this property has been made obsolete in 3.2.0. For the other properties, I recommend the following page: https://github.com/latex-lsp/texlab/blob/master/docs/previewing.md In particular,-preview_continuous_mode
does not play nicely with forward search.
-
So, this seems to be a jet-lag between
texlab
andlsp-latex
, which provides thetexlab
options to emacs in a handylsp
configuration. If I need directly to modifytexlab
options, which configuration file I should change? I did not find this in the help page. -
AUCTEX, has the C-c C-a keybinding that compiles, opens the pdf for the first time, or refreshes it if already open. Now, after moving to
spacemacs
,texlab
,lsp
, andlatexmk
(which is a big story) I need to have the same behavior. Is it better to make it from: a..latexmrc
, like this:
$lualatex = 'lualatex --synctex=1 -view=pdf -pv -recorder %O -shell-escape %S';
$pdf_previewer = 'start emacsclient';
b. texlab
(which I do not know where to specifiy it, as I mentioned before)
c. or from lsp-latex
, which is an interface to texlab
, like at the end of their page
none of them is succesfful in launching the pdf after the first compilation.
Thanks so much in advance
I agree; however, when I compile, the bottom panel does not refresh deterministically. I mean some times refreshes and sometimes it keeps empty. The behaviour is not deterministic! I wasted a lot of time trying solving that. BTW, I installed texlab via archlinux distro: yay -S texlab, and emacs shows that it calls texlab2. Is this relevant?
The ArchLinux package should be up-to-date but the texlab2
part confuses me a bit. Maybe it is called texlab2
internally by Emacs because lsp-latex
still supports the legacy Kotlin version (< texlab 2.0.0
). Nevertheless, we never published an executable that was called texlab2
.
EDIT I think the problem is that texlab error buffer (the bottom panel) does not refresh. When I open another latex file it keeps looking at the previous one!
Hmm, this does look like an issue of the Emacs plugin to me. I recommend raising an issue over there at https://github.com/ROCKTAKEY/lsp-latex. If it turns out to be a texlab
issue, a log file would be helpful (`texlab -vvvv --log-file /some/path/texlab.log).
So, this seems to be a jet-lag between texlab and lsp-latex, which provides the texlab options to emacs in a handy lsp configuration. If I need directly to modify texlab options, which configuration file I should change? I did not find this in the help page.
The configuration is not read from a file per-se, instead the settings are passed to texlab
using the LSP protocol (it supports both push- and pull-based methods) so the configuration approach varies from editor to editor (or sometimes even plugin). Here is an example of how it is done in lsp-latex
: https://github.com/ROCKTAKEY/lsp-latex/blob/master/lsp-latex.el#L341
AUCTEX, has the C-c C-a keybinding that compiles, opens the pdf for the first time, or refreshes it if already open. Now, after moving to spacemacs, texlab, lsp, and latexmk (which is a big story) I need to have the same behavior. Is it better to make it from
I recommend the following:
If using a .latexmrc
file, then remove the previewing parts and let texlab
handle that. Then, add the following to your current options: lsp-latex-build-on-save t
(ignore the "This variable is obsoleted since texlab 3.0.0." part in the documentation; this property was re-introduced in the recent versions). Afterwards, you can configure Emacs to call lsp-latex-build
with a keybinding of your choice.
I solved all the issues, but one, by uninstalling texlab
and removing all the .cache
folder of emacs. (very brut-force approach, but it is done).
Now, the only remaining point is related to texlab-latexmk
:
- the pdf does not view after compilation (I have to open it, then it updates correctly in emacs whenever I re-compile).
- the continuous buiding option by
latexmk
does not work, although I put it in the.latexmkrc
and specified fortexlab
bylsp-latex-build-is-continuous t
Can you provide a MWE for the latexmk.rc
and the (setq ...)
options for texlab
that achieves the above? Thanks in advance.
Sorry for the late response. You can use the following Elisp configuration:
(setq lsp-latex-forward-search-executable "emacsclient")
(setq lsp-latex-forward-search-args
'("--eval"
"(lsp-latex-forward-search-with-pdf-tools \"%f\" \"%p\" \"%l\")"))
(setq lsp-latex-forward-search-after t)
(setq lsp-latex-build-on-save t)
Besides that, you do not usually need a .latexmkrc
file.
The setting lsp-latex-build-is-continuous t
is not needed anymore and basically does nothing in the latest version of texlab
.
If the PDF still does not open after compilation, then you can try executing the forward search manually. If it still does not work, this may be a problem with the lsp-latex plugin.
Thanks again for your time. The PDF does not open by itself, unless I do C-c C-a
, which calls the auctex. In addition, the continuous build on save for latexmk
does not work either. It just happened once that the PDF refreshes and shows some discrete characters. I think there is a bug as you said.