"Go to PDF" does not work.
"Go to PDF" does not work.
Environment
- TeXstudio: 4.8.7
- Qt: 6.4.2
- OS: Linux Ubuntu
- TeX distribution: installed by "add-apt-repository ppa:sunderme/texstudio"
Expected behavior
The PDF file window is focused, and the line in the PDF file matching the line in the text editor is highlighted.
Actual behavior
The PDF file is not focused, and the line in the PDF file is highlighted which does not match the line in the text editor.
How to reproduce
In the text editor window right-click to open a context-sensitive menu, choose "Go to PDF". (Try different lines in the text editor.)
go to pdf works in general
That does not mean that i may not work on your side. Make sure that a synctex... file is present, generated by pdflatex (filename.synctex.gz) If yes, depending on the actual document, not all positions may work. Check with a simple document.
<filename>.synctex.gz is updated together with <filename>.pdf.
The bug always occurs after I scroll the text n the text editor up or down using the scroll button on the mouse, and then open the context sensitive menu and select "Go to PDF".
this may be a similar issue that I found some time ago when using the context menu in the editor to start a preview. This function used the current cursor position, not the position of the mouse pointer, to determine the region to be previewed.
To reproduce: I scroll down the text editor using the scroll button, then left-click on a line, this line gets highlighted, then I right-click and select "Go to PDF", and nothing happens, even the PDF window does not get focus. My current TexStudio version is 4.8.7. In my previous version 4.8.5 everything worked.
To reproduce: I scroll down the text editor using the scroll button, then left-click on a line, this line gets highlighted, then I right-click and select "Go to PDF", and nothing happens, even the PDF window does not get focus. My current TexStudio version is 4.8.7. In my previous version 4.8.5 everything worked.
What happens if you press the hot key for View (in my case, it is F7)?
F7 works exactly like "Go to PDF" is expected to work! So, F7 is a replacement of "Go to PDF".
By the way, to reproduce my bug, scrolling is not necessary: just left-click on a line, right-click and select "Go to PDF".
another way is ctrl+left-mouse-click in the text
ctrl+left-mouse-click does not work for me.
not sure if there is a difference windows vs. linux, does anyone know?
just as a general remark, this is crystal ball debugging. There is no solid info what the reporter is doing. No minimal example. No step-by-step, not even info if default settings are used.
There is no solid info what the reporter is doing.
In my opinion, the sufficient information is provided. Let me know what is missing.
Please do not accumulate unresolved bugs.
Actual behavior
The PDF file is not focused, and the line in the PDF file is highlighted which does not match the line in the text editor.
The info recorded by synctex may not always be precise. Can you share a small and complete example (including at least .tex, .pdf, and .synctex.gz)?
maybe reversing the task helps.
Document:
\documentclass{article}
\begin{document}
\section{title1}
Use the buttons Show Error, Show Warning, Show BadBox (see tooltips) to choose whether error messages (red), warning messages (yellow) or messages for bad boxes (blue) will be shown or hidden. Use the button Show Log Markers to display or hide log marker icons left to the lines in the editor. The tooltips for the log markers show message details.
In case that the log file contains error messages the log panel is opened automatically (check option Show log in case of compile error, s. Build settings) and log markers are activated. The editor’s cursor will be placed in the first line which has an error marker (check option Go to error when displaying log, s. Adv. Editor settings).
You may use the buttons Previous Error and Next Error to jump back or forth to the previous or next error. The shortcuts for this are Ctrl+Shift+Up/Down, accordingly Ctrl+Alt+Up/Down (these you have to set up on your own, s. Shortcut options for actions in menu Idefix/Go to) and Alt+Shift+Up/Down are used for warnings and bad boxes respectively. You can jump between markers of any type with Ctrl+Up/Down.
\section{title2}
When you select an entry in the table then the editor (and the log file) scrolls to the corresponding location. The log markers will be activated (check option Show log markers when clicking log entry, s. Adv. Editor settings). The log file information can be shown or hidden by clicking on the Log File button. The Issues button offers a similar function for the table with the messages.
\end{document}
Step-by-step:
- compile with default pdflatex
- set cursor on "entry" (line 11, column 22)
- right click, select "Go to pdf"
- pdf viewer is opened and lowest paragraph is highlighted, see image below
So, from my point of view, everything works. What is necessary, that it does not work ?
I have done the 4 steps above. Step 4 fails. Using F7 instead of "Go to PDF" works.
Do you need these files?
issue-4091.aux
issue-4091.log
issue-4091.pdf
issue-4091.synctex.gz
issue-4091.tex
please demonstrate with a screencast
https://github.com/user-attachments/assets/bddc6106-901d-4b80-a031-3d33872c7790
By some reason, the menu item "Go to PDF" started working for me when the PDF window is in the foreground.
However, the PDF window consistently does not get focus if it is in the background.
Similarly, the menu item "Go to Source" does not transfer the focus from the PDF file to the text editor if the text editor is in the background.
See the attached issue-4091.webm.
This functionality worked in my previous version of TeXstudio.
(I will send the screencast of "Go to PDF" not working when the PDF window is in the foreground, when I catch the right conditions.)
When I minimize txs main window after having maximized external pdf-viewer and main window, then using Go to Source from the pdf-viewer's context menu opens the main window on top, but it is not maximized. Same effect when using ctrl+left-mouse-click instead of the context menu. This is not the case when the main window is maximized and hidden by the maximized pdf-viewer.
When using Go to PDF in main window opens the previously maximized pdf-viewer, regardless of minimizing it meanwhile. or not So this way is not affected.
This is with win10, current local msys2 build.
so, the actual claim is that, when using windowed pdf viewer, the pdf window does not get raised when "go to pdf" is called.
For me a change of the main txs window from maximized to normal window appears when selecting "Go to Source" while main txs window is actually minimized (after being maximized). Even so, "Go to Source" and "Go to PDF" work, i.e. window is raised, gets focus and text is highlighted. Animation:
OS: Win10, txs: current build
let me note that previous animation was done with default settings for txs.
@vbrover claims that both directions do not work (window not raised, no change in focus) when the taget window is not visible and the context menu is used. F7 does the job, but keyboard+mouse not. I assume that the target window is minimized and not moved to another screen or so. This assumption seems reasonable since he used the word "raised".
I had a brief look. Looks like qt/wayland (linux) issue
I have looked into it. apparently wayland does not allow programs to move its windows. That seems also to affect raise/hide. Looks like there is not much we can do.
Looks like there is not much we can do.
Implement "Go to PDF" like "F7"?
it is already the same code path
i close this. You can open a feature request which correctly states that we are talking about raising of pdf windows on wayland.