0

If I have a PDF file whose name is <\jobname>~[solved].pdf (with spaces in the absolute path and the file name), how can I create a TeXStudio user command that opens this file knowing that the following doesn't work in recognizing the intended full name:

"C:\Program Files\SumatraPDF\SumatraPDF.exe" -reuse-instance -inverse-search "\"C:/Program Files (x86)/texstudio/texstudio.exe\" \"%%f\" -line %%l" "?am [solved].pdf"

1 Answer 1

1

I have found the solution after some experimentation.

If the output PDF file is prefixed by a word [solved] and space (i.e. [solved]~<\jobname>.pdf), the command should be

"C:\Program Files\SumatraPDF\SumatraPDF.exe" -reuse-instance -inverse-search ""C:/Program Files (x86)/texstudio/texstudio.exe" "%%f" -line %%l" ?a"[solved]" ?m.pdf

On the other hand, if it is appended by a space and a word [solved] (i.e. <\jobname>~[solved].pdf), the command should be

"C:\Program Files\SumatraPDF\SumatraPDF.exe" -reuse-instance -inverse-search ""C:/Program Files (x86)/texstudio/texstudio.exe" "%%f" -line %%l" "?am ?"[solved]".pdf"

The key note here is to understand that a space is a terminating character, which needs to have a following ? in order to use further selectors/pathname parts/terminating characters.


For TeXstudio v3.0, unknowingly, the syntax of the first case has to be slightly modified to be

"C:\Program Files\SumatraPDF\SumatraPDF.exe" -reuse-instance -inverse-search ""C:/Program Files (x86)/texstudio/texstudio.exe" "%%f" -line %%l" ?a"[solved]" "?m".pdf

enter image description here

5
  • "C:\Program Files\SumatraPDF\SumatraPDF.exe" -reuse-instance -inverse-search ""C:/Program Files (x86)/texstudio/texstudio.exe" "%%f" -line %%l" ?a [Exam]" ?m.pdf"
    – Diaa
    Commented Sep 11, 2020 at 18:11
  • "C:\Program Files\SumatraPDF\SumatraPDF.exe" -reuse-instance -inverse-search ""C:/Program Files (x86)/texstudio/texstudio.exe" "%%f" -line %%l" ?a [Exam]" "?m".pdf
    – Diaa
    Commented Sep 11, 2020 at 18:11
  • ) is a terminating character for the selector ?. So, it should be "C:\Program Files\SumatraPDF\SumatraPDF.exe" "?a)[Exam] ?m.pdf"
    – Diaa
    Commented Sep 13, 2020 at 12:38
  • texfot −−quiet lualatex -synctex=1 -interaction=nonstopmode -shell-escape "\AtBeginDocument{\printanswersfalse}\input{%}" then call another user command to rename cmd.exe /C ren "?am.pdf" "[Exam] ?m.pdf". Check this for texfot and this for calling the command prompt.
    – Diaa
    Commented Oct 9, 2020 at 23:39
  • All the info in this file.
    – Diaa
    Commented Oct 29, 2020 at 23:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .