Preview opens the Latex compiled PDF on a different page.

Hi, I use Latex(Texmaker) for my technical writing. After updating my macOS to 14, I am facing an issue. Whenever I compile my Latex document using Texmaker, the compiled PDF opens the document's first page (not the page I was working on in .tex file). However, the toolbar of the Preview shows the page number of the PDF where I am working in the .tex file (but opens the first page). Before updating macOS to 14, the Preview used to open the same page of the PDF I was working on.

MacBook Air 13″, macOS 14.1

Posted on Dec 6, 2023 10:00 AM

Reply
16 replies

Feb 21, 2024 7:27 AM in response to VikingOSX

In this case you are closing preview before a compilation. The issue happens whenever you recompile a pdf (without closing preview).

I suspect this is a bug because before the update to macOS 14.x what used to happen is that after a recompilation of the pdf document, Preview would correctly reload the pdf in the correct page.

Let me proceed as follows then:

  1. Here is the pdf of a latex document, opened in Preview. (Notice that this has nothing to do with which latex editor/compiler I am using... since I got to the pdf file manually and opened it using preview. This is also has nothing to do with the internal pdf viewer used in vscode or whatever I would use to view the pdf inside my editor.)
  2. Notice that we are on page 97 here...
  3. Now **with Preview opened with this document** I will then go to the source and edit (so to trigger a recompilation by latex).
  4. Now, pay attention to the page described in the view bar. It still says we are on page 97. But in fact the displayed page is the very first page of the document.
  5. In this page, if you move it a bit, Preview quickly reload the view bar and changes the page number to 1.
  6. This happens in all pdfs I am editing with latex.
  7. To me it seems that the issue occurs whenever the pdf is changed on disk (because of recompilation) and Preview is opened with the said pdf, it doesn't correctly reload the document, as it was expected.
  8. The fact that the old page number is still displayed is even more indication that this is a bug.
  9. Another pdf viewer, like Okular, correctly reloads the document on change. I have no problem on using them, but it would be nice if Preview wouldn't have this bug because as I said previously, it is a bit annoying to have to install another pdf viewer just to view pdfs on this specific case.
  10. About reproducibility of this issue, I guess you need anything that can change a pdf? I am not so sure if this happens only with latex (since it builds a new pdf document whenever recompilation happens) or if it is reproducible with other software that can change documents on the fly.


Dec 6, 2023 10:29 AM in response to moghees007

Preview just opens PDFs in their entirety. It doesn't know or care about the page you were working on in a LaTeX source file within Texmaker (which has its own PDF viewer). Preview's Settings are quite limited for PDFs and one has the option of selecting to start on the last viewed page of the PDF or to use/not use logical page numbers. Check those.


Beyond that, there is no setting in Preview that can make it a slave application to Texmaker. I would update to the current version of Texmaker and confer with the vendor about the issue you are experiencing.


I see no resolution to what you want to achieve. You get the entire PDF regardless of where you were in the LaTeX source code.


I have the full MacTex 2023 installed on macOS 14.1.2 and TexShop v5.22 to generate PDFs from La[TeX] sources and Preview opens them just fine. I do not use Texmaker, or TeXStudio to add additional layers of complexity to the problem.

Feb 16, 2024 2:03 PM in response to VikingOSX

I am having the same issue as the original author of this question. Problem is: it used to work as intended before the update (also do macOS 14).

Notice that Preview isn't being used as slave app to the latex editor. The intention is that sometimes we want to see the whole document in preview, instead of inside TexMaker (or vscode in my case).


Whenever the pdf was recompiled what used to happen is that preview would reload the pdf and if the option "Start in the last viewed page" was enabled it would return to the same viewed page.


The option is like in the image above.


Hence, I also believe this is a bug, as it used to work before. Also, notice that when the pdf is recompiled in the navigation bar of preview the page number is shown as the previously page one is before recompilation.

But preview shows only the first page.

So a clear mismatch between the current page being displayed and the page number shown in the navigation bar.


The way I "fixed" this problem was by intalling okular via brew and use it instead. But that's not a proper solution and it is a bit annoying to have to install another pdf viewer just to have the correct behavior back.


Feb 17, 2024 10:14 AM in response to davidv92

I just generated a new PDF from the following using LuaLaTeX in TeXShop 5.27 (MacTeX 2023) on macOS 14.3.1:


\documentclass[12pt]{article}
%% \usepackage[fontsize=13pt]{scrextend}
\usepackage[left=0.5in,top=0.5in,bottom=0.5in,bindingoffset=0.5in]{geometry}
\usepackage{kantlipsum}
\usepackage{parskip}
\usepackage{fontspec}

\setmainfont[
%:
    %% Path = /usr/local/Texlive/2023/texmf-dist/fonts/opentype/public/qualitype/,
    Path = /System/Library/Fonts/Supplemental/,
    ] {Georgia.ttf}

\begin{document}
%% paragraphs 1 thru 6
\kant[1-6]
\end{document}


That resulted in a two-page PDF. Before I opened the PDF, I changed my Preview Settings to what you share above, and then opened the PDF. I switched to the second icon, closed the current window and quit Preview.


When I reopened Preview again with the same PDF, the second icon was lit and that page was current. This might be even more discrete, by changing the Show as from [ Continuous Scroll ] to [ Single Page ].


So, based on this, I cannot recreate your stated issue and in my test, Preview did exactly as it was instructed, and went to the last page viewed.



Feb 21, 2024 2:56 AM in response to moghees007

I don't use TeXMaker (*), but I know that it has its own PDF viewer built-in.

Would that be a viable alternative,instead of constantly switching to/from Preview?


Besides, I am surprised that you said you use MikTeX - I had to check to see that there is MikTeX for the mac. Always learning...



(*) I have been using TeXShop for some 22 years now... (and mactex, the mac distribution based on texlive, for more than a decade) 😎

Feb 21, 2024 5:00 AM in response to moghees007

Neither Luis nor I use TeXMaker. We don't have your TeX source to test this with TeXShop and the MikTeX/TeXMaker and MacTeX/TeXShop distributions may be different enough to make this PDF issue unreproducible.


What I suggest is that you open this same PDF in a current (free) version of Adobe Acrobat Reader. Once you do that, visit Acrobat Reader Preferences : Documents panel and select Restore last view settings when reopening documents. Quit the application and reopen the PDF. What do you see?


Apple's Preview PDF handling and Adobe's ability to keep Acrobat Reader current to PDF spec are night and day in comparision owing to the cost and disruption of modernizing Preview.

Feb 21, 2024 7:58 AM in response to Luis Sequeira1

Luis Sequeira1 wrote:

Thank you for the detailed explanation.

I do not normally use Preview to view my pdf files created from LaTeX, as TeXShop has its own pdf display, but I did try it with Preview just to see if I could reproduce the problem.
I opened a pdf in Preview, selected page 19, then made some edits and typeset. Preview worked as expected, updating the pdf and showing the correct page.
So it seems that this, even if it is a bug, does not happen to everyone.
I am using Sonoma 14.3.1, in case this is relevant.

I see, that makes it even more difficult to isolate the reasons for it to happen then :(


I also use the internal pdf viewer. But since I usually work on a 14'' Macbook Pro, sometimes I like to read the document in its isolated preview page for reviewing and whatnot.

The version of my macOS is also 14.3.1.

I will try to investigate the issue further and comment here if I discover anything new. Thank you for also testing it.

Feb 21, 2024 7:36 AM in response to davidv92

Thank you for the detailed explanation.


I do not normally use Preview to view my pdf files created from LaTeX, as TeXShop has its own pdf display, but I did try it with Preview just to see if I could reproduce the problem.

I opened a pdf in Preview, selected page 19, then made some edits and typeset. Preview worked as expected, updating the pdf and showing the correct page.

So it seems that this, even if it is a bug, does not happen to everyone.

I am using Sonoma 14.3.1, in case this is relevant.


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Preview opens the Latex compiled PDF on a different page.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.