Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where are the compilation errors? #491

Closed
DrWaleedAYousef opened this issue Oct 2, 2021 · 8 comments · Fixed by #823
Closed

Where are the compilation errors? #491

DrWaleedAYousef opened this issue Oct 2, 2021 · 8 comments · Fixed by #823

Comments

@DrWaleedAYousef
Copy link

Thanks so much for the great project.
image

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?

@pfoerster
Copy link
Member

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?

@DrWaleedAYousef
Copy link
Author

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.

  1. texlab erros that should appear automatically in the .tex buffer do not show automatically after saveing or while editing.
  2. 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")
        )

@pfoerster
Copy link
Member

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.

@DrWaleedAYousef
Copy link
Author

DrWaleedAYousef commented Oct 5, 2021

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 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.

  1. 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?

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.

  1. 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.

  2. 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:
    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

@pfoerster
Copy link
Member

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.

@DrWaleedAYousef
Copy link
Author

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:

  1. the pdf does not view after compilation (I have to open it, then it updates correctly in emacs whenever I re-compile).
  2. the continuous buiding option by latexmk does not work, although I put it in the .latexmkrc and specified for texlab by lsp-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.

@pfoerster
Copy link
Member

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.

@DrWaleedAYousef
Copy link
Author

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.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Apr 27, 2023
## [5.5.0] - 2023-04-16

### Added

- Allow optionally passing cursor position to `textDocument/build` request for use in forward search after building.
  Previously, the server had to guess the cursor position ([#475](latex-lsp/texlab#475))
- Add experimental `texlab.experimental.citationCommands` setting to allow extending the list of citation commands
  ([#832](latex-lsp/texlab#832))
- Add support for escaping placeholders in build arguments similar to forward search
- Allow configuring completion matching algorithm ([#872](latex-lsp/texlab#872))

### Fixed

- Fix regression introduced in `v5.4.2` involving `texlab.cleanArtifacts` command.

## [5.4.2] - 2023-04-11

### Fixed

- Fix memory leak when editing documents over a long time ([#856](latex-lsp/texlab#856))
- Fix parsing parentheses in file paths ([#874](latex-lsp/texlab#874))

## [5.4.1] - 2023-03-26

### Fixed

- Do not return symbols with empty names (e. g. sections without name) ([#870](latex-lsp/texlab#870))
- Repair `textDocument/formatting` request ([#871](latex-lsp/texlab#871))

## [5.4.0] - 2023-03-12

### Added

- Add experimental settings to allow extending the list of special environments:
  - `texlab.experimental.mathEnvironments`
  - `texlab.experimental.enumEnvironments`
  - `texlab.experimental.verbatimEnvironments`
- Add `texlab.changeEnvironment` workspace command ([#849](latex-lsp/texlab#849))
- Add `texlab.showDependencyGraph` workspace command

### Changed

- Do not show caption or section names in label inlay hints ([#858](latex-lsp/texlab#858))
- Include more user-defined commands in command completion

### Fixed

- Parse nested `\iffalse` blocks correctly ([#853](latex-lsp/texlab#853))
- Parse commands with multi-byte characters correctly ([#857](latex-lsp/texlab#857))
- Fix checking whether a document can be a root file

## [5.3.0] - 2023-02-25

### Added

- Allow filtering `textDocument/documentSymbols` using regular expressions specified via
  `texlab.symbols.allowedPatterns` and `texlab.symbols.ignoredPatterns`
  ([#851](latex-lsp/texlab#851))

### Fixed

- Do not use percent-encoded path when searching for PDF files during forward search
  ([#848](latex-lsp/texlab#848))
- Always return an empty list of code actions instead of returning "method not found" ([#850](latex-lsp/texlab#850))

## [5.2.0] - 2023-01-29

### Added

- Include line numbers in build warnings when available ([#840](latex-lsp/texlab#840))
- Add `none` formatter to `texlab.latexFormatter` and `texlab.bibtexFormatter` options
  to allow disabling formatting ([#846](latex-lsp/texlab#846))

### Fixed

- Concatenate more than two lines of maximum length in build diagnostics ([#842](latex-lsp/texlab#842))
- Apply the correct range of references to labels when renaming ([#841](latex-lsp/texlab#841))
- Use `document` environment to detect root file instead of `\documentclass` ([#845](latex-lsp/texlab#845))

## [5.1.0] - 2023-01-21

### Added

- Allow manually overriding the root directory using a `texlabroot`/`.texlabroot` marker file.
  See the wiki for more information.
  ([#826](latex-lsp/texlab#826), [#838](latex-lsp/texlab#838))

### Deprecated

- Deprecate `texlab.rootDirectory` setting in favor of `.texlabroot` files

### Fixed

- Do not use `.git`, `.chktexrc`, `.latexmkrc` files/directories to determine the root directory
  ([#826](latex-lsp/texlab#826))
- Fix building documents without an explicit root directory ([#837](latex-lsp/texlab#837))

## [5.0.0] - 2022-12-29

### Changed

- _BREAKING_: `texlab.rootDirectory` is now used as the folder path from which the compiler is executed
  relative to the main document. By default it is equal to `"."`. For more information, please visit the wiki.
- Improve performance of completion by a huge margin due to a faster filtering method used internally
- Do not discover project files beyond the provided workspace folders
- Try to guess the root directory by checking for files such as `.latexmkrc` or `Tectonic.toml` if `texlab.rootDirectory` is not set

### Fixed

- Update positions of reported build diagnostics when editing the affected line
- Do not treat links to files as bidirectional by default. This prevents issues where `texlab` ends up compiling the wrong file
  in projects with shared files ([#806](latex-lsp/texlab#806), [#757](latex-lsp/texlab#757), [#679](latex-lsp/texlab#679))
- Fix coverage of directories which need to be watched for changes ([#502](latex-lsp/texlab#502), [#491](latex-lsp/texlab#491))
- Resolve links of the `import` package correctly
- Use `filterText` of completion items when filtering internally ([#829](latex-lsp/texlab#829))

## [4.3.2] - 2022-11-20

### Fixed

- Do not try to run the TeX engine on package files and fail the build instead ([#801](latex-lsp/texlab#801))
- Handle URIs with URL-encoded drive letters on Windows ([#802](latex-lsp/texlab#802))
- Parse BibTeX entries with unbalanced quotes correctly ([#809](latex-lsp/texlab#809))
- Provide completion for more acronym commands ([#813](latex-lsp/texlab#813))
- Fix parsing acronym definitions ([#813](latex-lsp/texlab#813))

## [4.3.1] - 2022-10-22

### Fixed

- Do not crash with a stack overflow when trying to load packages with many internal dependencies ([#793](latex-lsp/texlab#793))
- Normalize drive letters of all document URIs
- Fix parsing commands that take file paths as arguments ([#789](latex-lsp/texlab#789))
- Use the correct working directory and command line arguments when calling `latexindent` ([#645](latex-lsp/texlab#645))
- Fix publishing to CTAN

## [4.3.0] - 2022-09-25

### Added

- Add inlay hints for `\label{...}` ([#753](latex-lsp/texlab#753))

### Fixed

- Improve accuracy of the error locations reported by the TeX engine ([#738](latex-lsp/texlab#738))
- Reduce number of false positive errors reported by `texlab` ([#745](latex-lsp/texlab#745))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants