![]() Eventhough I said abuse the jobname this is fairly handy and may easily be considered a feature. For that it should be enough, to just create links to your main file, and then open and compile the links instead. Let's say you want to compile some exercises with or without solutions, and maybe for four different groups or something. It might be tempting to abuse the jobname to transfer variables. If the goal is to abuse the jobname for Variables If you have Python or powershell installed, you may want to use them to get the timestamp instead. Sadly for windows the format of date is highly dependant on your regional settings. You can replace it with any combination of %%Y or (4-digit/2-digit years) %%m (2-digit month) and %%d (day) separated by dash, underscore or dot. Note we had to escape to the commandline to get the date. Windows: txs:///compile | cmd /C "move %.pdf %?te%%.%.pdf" Just build a (chain-)command like this: Linux: txs:///compile | sh -c "mv %.pdf $(date '%%F').%.pdf" And while you can do a lot with overwriting the jobname in the first line and setting up a magic comment for it in the second line, it's not complete and my gut tells me that it would be fairly stupid indeed.ĭo so afterwards. ![]() Sh -c "echo '"$(date '%%F').%"' > timestamp.txt" I have yet to find a way to read it into a variable in TeXStudios internal calls. Also while you can save the date into a file with this: Note that while you can export variables like this, you cant just chain it, as TeXStudio drops the variable. The compilation would then be done by: txs:///compile/ Then it might be possible to call it like this: Linux: sh -c "export jobname=$(date '%%F').% /path/to/texstudio %.tex" either do so directly or call TeXStudio from within itself over a helper-script or over the commandline. You might call TeXStudio from a commandline, where the date or the jobname is setup as a variable. So here's universal variation Using the write18 command (for linux use sh -c instead of cmd /C) windows portable: cmd /C """/././texlive/2019/bin/win32/pdflatex.exe -shell-escape \immediate\write18" ![]() Note that you might have to adjust the path to the pdflatex executable.Įdit: Apparantly windows cannot read the variable from instanced shells. Windows: cmd /C "pdflatex.exe -synctex=1 -interaction=nonstopmode -jobname=%?te%%.% %.tex" In this example, I use pdflatex as compiler: Linux: sh -c "pdflatex -synctex=1 -interaction=nonstopmode -jobname=$(date '%%F').% %.tex" You then replace the jobname by the date given from your commandline. If it uses chaining, you must do so for each element. If the compiling command is using alias, you must dereference it. Note: This highly depends on what your goal is.
0 Comments
Leave a Reply. |