[Tex/LaTex] TeXstudio, no preview pdf file after compiling using User Commands

mintedtexstudioviewers

I was trying to use package minted to insert Python code in my document and now succeeded in compiling and could generate the correct PDF file. I followed this thread which said it's better to create your own user command contained

pdflatex -shell-escape -synctex=1 -interaction=nonstopmode %.tex

But using this command to compile will not pop up the internal pdfviewer as using F5 to compile.

I tried goto

Options > Configure TeXStudio > Commands

and changed

pdflatex -synctex=1 -interaction=nonstopmode %.tex

into

pdflatex -shell-escape -synctex=1 -interaction=nonstopmode %.tex

then compiled through F5 again. This time it compiled correct and pop up the internal pdfviewer.

How can I still using user command but have internal pdfviewer at the same time?

Best Answer

Under Configure TeXstudio -> Build -> User commands, you can 'stack' the commands with the | character, so something like:

pdflatex --shell-escape -synctex=1 -interaction=nonstopmode %.tex | txs:///view-pdf

should work. (see red box)

enter image description here

Alternatively, you can click the 'Spanner' icon (blue box in pic) to configure the Quick build command, in which you can add TXS-specific commands to the list, including view-pdf:

quickbuild