Menu

#2064 Magic comment causes the internal PDF viewer to misbehave

None
fixed
nobody
None
1
2017-02-18
2017-02-03
Stefano
No

I'm working collaboratively on a tex document, and this magic comment appeared on top of the main file (because I guess someone is using TeXShop or TeXworks):

%!TEX TS-program = pdflatex

I think TeXstudio doesn't really like this magic comment, because it causes the intenal PDF viewer not to start. In particular, TeXstudio always launches the external viewer rather than the internal one, even if the latter is set as the default via Settings -> Build -> Default Viewer = txs:///view-pdf-internal --embedded.

I couldn't find a way to make TeXStudio ignore the magic comment. Is it possible?

Discussion

  • Stefano

    Stefano - 2017-02-03

    -- Just an additional point. Of course I can very easily comment the line with an additional % and it will work just fine. I am asking for a way to do this with some option because we're versioning tex files with git, and it's impractical if this other guy and I constantly comment/uncomment the line whenever we have to compile before pushing our changes.

     
  • Tim Hoffmann

    Tim Hoffmann - 2017-02-04

    Works fine here.

    • Which version of TXS are you using?
    • Which command do you use, that shows the behavior?
    • Please run Help -> Check LaTeX Configuration and provide the part "Command configuration in TeXstudio"
     
  • Stefano

    Stefano - 2017-02-06

    I am using TeXstudio 2.12.2, and the command I'am using that bound to the magnifier lens button, I guess "txs:///view-pdf-internal --embedded".

    Command configuration in TeXstudio:
        External PDF Viewer (view-pdf-external): "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe" "?am.pdf"
        PDF Chain (pdf-chain): txs:///pdflatex | txs:///view-pdf
        DviPng (dvipng): dvipng.exe -T tight -D 120 %.dvi
        DVI->PDF Chain (dvi-pdf-chain): txs:///latex | txs:///dvipdf | txs:///view-pdf
        Metapost (metapost): mpost.exe -interaction=nonstopmode ?me)
        Ps2Pdf (ps2pdf): ps2pdf.exe %.ps
        SVNADMIN (svnadmin): 
        make bib (user1): make bib
        Makeglossaries (makeglossaries): makeglossaries %
        PDF Viewer (view-pdf): txs:///view-pdf-external
        Makeindex (makeindex): makeindex.exe %.idx
        Texindy (texindy): texindy.exe %.idx
        make (user0): make
        Internal Precompile (internal-pre-compile): txs:///pre-compile | txs:///conditionally-recompile-bibliography
        SVN (svn): 
        Default Index Tool (index): txs:///makeindex
        BibTeX 8-Bit (bibtex8): bibtex8.exe %
        BibTeX (bibtex): bibtex.exe %
        Default Glossary Tool (glossary): txs:///makeglossaries
        Recompile Bibliography (recompile-bibliography): txs:///compile | txs:///bibliography | txs:///compile
        LaTeX (latex) (r): latex.exe -src -interaction=nonstopmode %.tex
        DVI->PS->PDF Chain (dvi-ps-pdf-chain): txs:///latex | txs:///dvips | txs:///ps2pdf | txs:///view-pdf
        Build & View (quick): txs:///compile | txs:///view
        Asymptote DVI Chain (asy-dvi-chain): txs:///latex | txs:///asy | txs:///latex | txs:///view-dvi
        Default Viewer (view): txs:///view-pdf-internal --embedded
        DviPdf (dvipdf): dvipdfm.exe %.dvi
        Latexmk (latexmk): latexmk -pdf -silent -pdflatex="pdflatex -synctex=1 %%O %%S" %
        make fixbiber (user2): make fixbiber
        Asymptote (asy): 
        PS Viewer (view-ps): "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe" "?am.ps"
        DVI Viewer (view-dvi): "C:\Program Files\MiKTeX 2.9\miktex\bin\x64\yap.exe" -1 -s @?"c:ame "?am.dvi"
        DviPs (dvips): dvips.exe -o %.ps %.dvi
        LuaLaTeX (lualatex) (r): lualatex.exe -synctex=1 -interaction=nonstopmode %.tex
        Ghostscript (gs): mgs.exe "?am.ps"
        Asymptote PDF Chain (asy-pdf-chain): txs:///pdflatex | txs:///asy | txs:///pdflatex | txs:///view-pdf
        Biber (biber): biber.exe %
        Precompile (pre-compile): 
        test (user3): ./test.bat 
        Default Bibliography Tool (bibliography): txs:///bibtex
        Default Compiler (compile) (r): txs:///pdflatex
        XeLaTeX (xelatex) (r): xelatex.exe -synctex=1 -interaction=nonstopmode %.tex
        PS Chain (ps-chain): txs:///latex | txs:///dvips | txs:///view-ps
        PdfLaTeX (pdflatex) (r): pdflatex.exe -synctex=1 -interaction=nonstopmode %.tex
        DVI Chain (dvi-chain): txs:///latex | txs:///view-dvi
    
     
  • Tim Hoffmann

    Tim Hoffmann - 2017-02-06

    the command I'am using that bound to the magnifier lens button, I guess "txs:///view-pdf-internal --embedded".

    There's the point. This button is button is bound to PDF Viewer (view-pdf) which is set up to use the external viewer. Change it to txs:///view-pdf-internal --embedded and you'll be good.

     
  • Stefano

    Stefano - 2017-02-07

    This is funny, I didn't know it was supposed to be that way. So why does the lens button show the embedded viewer when I comment the line out, even if it is set to view-pdf-external?

    Here is some testing I have done:
    1. Line commented, view-pdf-external -> embedded viewer
    2. Line commented, view-pdf-internal --embedded -> embedded viewer
    3. Line uncommented, view-pdf-external -> external viewer
    4. Line uncommented, view-pdf-internal --embedded -> embedded viewer

    Case 1 seems weird, and is the way I always used TXS, without knowing, until now. I always thought the lens was bound to the internal viewer.

     
  • Tim Hoffmann

    Tim Hoffmann - 2017-02-07

    1 seems weird indeed. Please provide a minimal example file.

     
  • Stefano

    Stefano - 2017-02-13

    Actually, the minimal example is really really minimal (I think this has to do with some TeXstudio setting, rathern than with latex).

    %%!TEX TS-program = pdflatex
    
    \documentclass{article} 
    
    \begin{document}
    
    Hi!
    
    \end{document}
    

    Compiling this and clicking on the magnifier lens button doesn't open the external viewer, even if PDF Viewer (view-pdf) is bound to txs:///view-pdf-external.

    The viewer opens correctly after clicking on the lens button if on the other hand I compile this:

    %!TEX TS-program = pdflatex
    
    \documentclass{article} 
    
    \begin{document}
    
    Hi!
    
    \end{document}
    
     
  • Tim Hoffmann

    Tim Hoffmann - 2017-02-15

    Well, my statement above on the view button was not exact.

    Under normal circumstances, the view button is bound to txs:///view. When you define a specific compiler using %!TEX TS-program it gets reassigned to txs:///view-dvi for latex and to txs:///view-pdf for pdflatex, xelatex and luatex/lualatex (for internal reference: Texstudio::commandLineRequested).

    Generally, it is good practice (and default) to set txs:///view to txs:///view-pdf and define the viewer details in txs:///view-pdf

     
  • Jan  Sundermeyer

    Jan Sundermeyer - 2017-02-15

    so, won't fix ?

     
    • Tim Hoffmann

      Tim Hoffmann - 2017-02-15

      To be discussed. see my personal mail.

       
  • Tim Hoffmann

    Tim Hoffmann - 2017-02-18

    Code changes as a result of this report.

    hg 6415 (70a7aa5a3407):
    remove pdf viewer subtypes from "Default Viewer" config
    The "Default Viewer" should only select between dvi/ps/pdf. PDF viewer subtypes
    should be selected in "PDF Viewer".

    hg 6417 (74c3060c4fad)
    option to deactivate interperation of command definition in magic comments

    This should make it more obvious and better to control.

     
  • Tim Hoffmann

    Tim Hoffmann - 2017-02-18
    • status: open --> fixed
    • Group: -->
     

Log in to post a comment.