Giter Club home page Giter Club logo

Comments (4)

lervag avatar lervag commented on August 16, 2024

First of all, thank you for making such a good plugin, it's already the third (or maybe fourth) year that I enjoy writing in Latex with the great help of vimtex.

<3

Is your feature request related to a problem? Please describe it.

Currently, when the float specifier changes (e.g. from h to ht), the error message does not specify which float changed it. The warning message just says main.tex|| LaTeX Warning: `h' float specifier changed to `ht'.

This is very hard to improve on. The problem is that there is no line number information in the log file. Consider this:

\documentclass{memoir}
\usepackage{graphicx}
\usepackage{blindtext}
\begin{document}
\blindtext[4]
\begin{figure}[h]
    \begin{center}
        \includegraphics[width=0.95\textwidth]{example-image-a}
    \end{center}
    \caption{dasdasdas}\label{fig:qwe}
\end{figure}

Some text Some text Some text Some text Some text Some text Some text Some text Some text 
Some text Some text Some text Some text Some text Some text Some text Some text Some text 
Some text Some text Some text Some text Some text Some text Some text Some text Some text 
Some text Some text Some text Some text Some text Some text Some text Some text Some text 
Some text Some text Some text Some text Some text Some text Some text Some text Some text 
Some text Some text Some text Some text Some text Some text Some text Some text Some text 
\begin{figure}[h]
    \begin{center}
        \includegraphics[width=0.95\textwidth]{example-image-a}
    \end{center}
    \caption{dslkadjaslkdj}
    \label{fig:SpinDistributionModel}
\end{figure}

\end{document}

(Notice the use of example-image-[ab], which is a nice little builtin feature.)

Now, if we compile, we get the following output (more or less):

This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Arch Linux) (preloaded format=pdflatex 2023.12.18)  4 JAN 2024 17:30
entering extended mode
 \write18 enabled.
 file:line:error style messages enabled.
 %&-line parsing enabled.
**test.tex
(./test.tex
LaTeX2e <2022-11-01> patch level 1
L3 programming layer <2023-02-22> (/usr/share/texmf-dist/tex/latex/memoir/memoir.cls
Document Class: memoir 2022/11/17 v3.7.19 configurable book, report, article document class

… (CUT OUT)

<example-image-a.pdf, id=1, 321.2pt x 240.9pt>
File: example-image-a.pdf Graphic file (type pdf)
<use example-image-a.pdf>
Package pdftex.def Info: example-image-a.pdf  used on input line 8.
(pdftex.def)             Requested size: 323.94896pt x 242.96889pt.


LaTeX Warning: `h' float specifier changed to `ht'.

<example-image-b.pdf, id=2, 321.2pt x 240.9pt>
File: example-image-b.pdf Graphic file (type pdf)
<use example-image-b.pdf>
Package pdftex.def Info: example-image-b.pdf  used on input line 21.
(pdftex.def)             Requested size: 323.94896pt x 242.96889pt.
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}

]

LaTeX Warning: `h' float specifier changed to `ht'.

[2 </usr/share/texmf-dist/tex/latex/mwe/example-image-a.pdf>] [3 </usr/share/texmf-dist/tex/latex/mwe/example-image-b.pdf>] (./test.aux) ) 

The warnings are not really directly related to the info about the "example-image-… used on input line X", and as you see, there is not other info.

from vimtex.

lervag avatar lervag commented on August 16, 2024

If I knew a way to get the necessary information, then I might consider trying to make it work better. But I don't, and I've never heard of something like that before.

I'm closing, but feel free to continue the discussion. In particular, if you have any ideas, feel free to share.

from vimtex.

gssfaw avatar gssfaw commented on August 16, 2024

If I knew a way to get the necessary information, then I might consider trying to make it work better. But I don't, and I've never heard of something like that before.

Yes, these log messages are indeed difficult to parse. And I've had the messages related to one float separated by the other log messages. I suppose there is no clear way to implement a stable method to deduce the exact float.

I am not sure what the log parser can do, but maybe there is a way to implement a jump to the position of the message in the log file, instead of just jumping to the beginning of the main file?

from vimtex.

lervag avatar lervag commented on August 16, 2024

I am not sure what the log parser can do, but maybe there is a way to implement a jump to the position of the message in the log file, instead of just jumping to the beginning of the main file?

I can see how using e.g. the line number of the previous entry could be convenient, but I'm skeptical. I believe it would be confusing to people that don't know of this behaviour.

I think the way to implement this is to enrich the relevant quickfix entries after the log file is fully parsed, similar to what we do here:

for l:qf in l:qflist
" Handle missing buffer/filename: Fallback to the main file (this is always
" correct in single-file projects and is thus a good fallback).
if l:qf.bufnr == 0
let l:bufnr_main = bufnr(self.main)
if bufnr(self.main) < 0
execute 'badd' self.main
let l:bufnr_main = bufnr(self.main)
endif
let l:qf.bufnr = l:bufnr_main
endif
" Try to parse the filename from logfile for certain errors, except for
" large log files where this makes for bad UI because it locks Vim while
" waiting for this parsing to finish.
if l:nlines < 10000
\ && s:fix_paths_hbox_warning(l:qf, l:lines, self.root, l:hbox_cache)
continue
endif

from vimtex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.