2

After migrating from Windows to OSX, the latex project I was working on results in TexShop hanging.

As far as I can see, the reason is that the resulting pdf is over 40mb in size and fails to open in either Preview or TexShop.

To open the .tex file in TexShop, I have to delete the precompiled pdf - afterwards everything works fine. The source compiles and a pdf is generated. But then, immediately after compilation finishes, TexShop freezes. The only way to proceed is to force quit.

If I try to open the pdf file in Preview, Preview also freezes. In Adobe Acrobat everything opens up fine. I haven't had any of these issues on Windows before.

Would anyone be able to suggest a possible solution to this?

Cheers.

  • Welcome, is the pdf generated successfully? Or does pdf(la)tex hang without finishing? Or does it kill itself without creating/finishing a pdf? Please check the log-file. – Johannes_B Apr 23 '17 at 9:36
  • Welcome to TeX.SE. I belive that there is a bug in the pdf kit with the MacOS Sierra (10.12.4) and don't think that it is yet fixed in the 10.12.5 developer builds yet. Acrobat does not share the same code that TeXShop and Preview share, so it can read it just fine. – Peter Grill Apr 23 '17 at 9:45
  • Yes, the pdf is generated perfectly fine. The last lines of the output are the following: Output written on t***.pdf (170 pages, 44171213 bytes). PDF statistics: 5840 PDF objects out of 6186 (max. 8388607) 2206 compressed objects within 23 object streams 417 named destinations out of 1000 (max. 500000) 79209 words of extra memory for PDF output out of 89155 (max. 10000000) – Nick Apr 23 '17 at 9:46
  • Is there at least a way to disable preview in TexShop, so I don't have to force quit every time? – Nick Apr 23 '17 at 9:47
  • The only solution I can think of at the moment (BTW, I am not an expert at TeXShop so others may be able to help you more), is to create a custom .engine that runs pdflatex and provides a different -jobname option so that the output .pdf file has a different name which does not trigger a reload. You can then open the .pdf file in Acrobat and continue to work in TeXShop. Setting this up should not be difficult -- if you are interested in this, I am sure a posting new question asking specifically for this will yield a .engine script fairly quickly. – Peter Grill Apr 23 '17 at 10:27
1

After considering the above suggestions (thanks, Peter!), I have modified the pdflatexmk.engine. The following worked for me:

#!/bin/bash
export TSBIN="$HOME/Library/TeXShop/bin/tslatexmk"
export LTMKBIN="$HOME/Library/TeXShop/bin/tslatexmk"
export LTMKEDIT="$HOME/Library/TeXShop/bin"
# make sure latexmkrcedit exists in bin
if [ ! -e "${LTMKEDIT}/latexmkrcedit" ] ; then
    cp "${LTMKBIN}/latexmkrcDONTedit" "${LTMKEDIT}/latexmkrcedit"
fi
# Use local rc file platexmkrc if it exists. p = project
export localrc=""
if [ -e ./platexmkrc ] ; then
    export localrc="-r ./platexmkrc"
fi
"${LTMKBIN}"/latexmk -pdf -r "${LTMKEDIT}/latexmkrcedit" -r 
"${TSBIN}/pdflatexmkrc" ${localrc} "$1" -pv- -view=none

filename=$(basename "$1")
fn="${filename%.*}"
mv "$fn.pdf" "$fn-out.pdf" 

open -a "Adobe Acrobat.app" "$fn-out.pdf"

In essence, straight after the pdf is generated, it is renamed with a different filename. This tricks TexShop into thinking that no pdf is available for preview. The adobe viewer is then run to view the pdf file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.