Wrong line when syncing from within \textbf{}
Opened this issue · 2 comments
Minimal example:
\documentclass{article}
\begin{document}
\textbf{First Line\\
Second Line}
\end{document}
When syncing "First Line" from PDF to source, synctex returns line number 4, which is the line of "Second Line".
The correct line 3 is returned, if I don't use \textbf
but still the braces.
\documentclass{article}
\begin{document}
{First Line\\
Second Line}
\end{document}
Here is the diff of the two synctex files (left with \textbf
, right without):
Very good example, thanks for pointing this out.
This is showing that the synctex file does not contain enough information
to synchronize properly. Sometimes 3 should return, sometimes 4.
Once TeX can record the line AND the column, then it will be "easy" to solve this problem.
The problem in this case is not the column information, it's the fact that the \textbf
macro is involved.
As explained in https://tex.stackexchange.com/questions/39678/forward-inverse-search-using-synctex-with-the-precison-of-a-single-word :
For example, if you ctrl-click on a word in the output title of a latex document, should you be backwarded to the line containing the \maketitle command (the one that created the title) or the line containing the \title command (the one that defined the title). Both solutions are acceptable, none is universally better than the other.
In this case, the analog of "the line containing the \title command" is "the line at the end of the \textbf
macro invocation". That said, trying to implement the other alternative (synctex point to the original location of the word) would be very difficult, involving storing the synctex tag into each token as well as each box, which leads to a large overhead.
(There's a possible implementation of column information at #89 but as you can see it doesn't help with this issue.)