texstudio icon indicating copy to clipboard operation
texstudio copied to clipboard

"Go to PDF" does not work.

Open vbrover opened this issue 6 months ago • 22 comments

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

vbrover avatar Jun 09 '25 00:06 vbrover

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.

sunderme avatar Jun 09 '25 06:06 sunderme

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

vbrover avatar Jun 09 '25 13:06 vbrover

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.

octaeder avatar Jun 09 '25 15:06 octaeder

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.

vbrover avatar Jun 09 '25 19:06 vbrover

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)?

tmelorc avatar Jun 10 '25 11:06 tmelorc

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

vbrover avatar Jun 10 '25 13:06 vbrover

another way is ctrl+left-mouse-click in the text

octaeder avatar Jun 10 '25 14:06 octaeder

ctrl+left-mouse-click does not work for me.

vbrover avatar Jun 10 '25 14:06 vbrover

not sure if there is a difference windows vs. linux, does anyone know?

octaeder avatar Jun 10 '25 14:06 octaeder

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.

sunderme avatar Jun 10 '25 17:06 sunderme

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.

vbrover avatar Jun 10 '25 17:06 vbrover

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)?

muzimuzhi avatar Jun 11 '25 17:06 muzimuzhi

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:

  1. compile with default pdflatex
  2. set cursor on "entry" (line 11, column 22)
  3. right click, select "Go to pdf"
  4. pdf viewer is opened and lowest paragraph is highlighted, see image below

Image

So, from my point of view, everything works. What is necessary, that it does not work ?

sunderme avatar Jun 11 '25 19:06 sunderme

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

vbrover avatar Jun 12 '25 14:06 vbrover

please demonstrate with a screencast

sunderme avatar Jun 12 '25 19:06 sunderme

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

vbrover avatar Jun 13 '25 21:06 vbrover

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.

octaeder avatar Jun 14 '25 00:06 octaeder

so, the actual claim is that, when using windowed pdf viewer, the pdf window does not get raised when "go to pdf" is called.

sunderme avatar Jun 14 '25 07:06 sunderme

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:

Image

OS: Win10, txs: current build

octaeder avatar Jun 14 '25 10:06 octaeder

let me note that previous animation was done with default settings for txs.

octaeder avatar Jun 14 '25 10:06 octaeder

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

octaeder avatar Jun 14 '25 10:06 octaeder

I had a brief look. Looks like qt/wayland (linux) issue

sunderme avatar Jun 14 '25 10:06 sunderme

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.

sunderme avatar Jun 25 '25 18:06 sunderme

Looks like there is not much we can do.

Implement "Go to PDF" like "F7"?

vbrover avatar Jun 25 '25 18:06 vbrover

it is already the same code path

sunderme avatar Jun 25 '25 18:06 sunderme

i close this. You can open a feature request which correctly states that we are talking about raising of pdf windows on wayland.

sunderme avatar Jul 05 '25 08:07 sunderme