2

When I go to TexStudio -> Options -> Configure TexStudio -> Build -> User Commands, I can add arbitrary shell commands. Inside the commands, I can use the character % to refer to the current file name - without extension and without folder. How can I refer to the folder of the current file?

The manual says: "If you need more options (e.g. absolute paths) use ? and look at the instruction on the bottom of the configuration dialog." But I did not find these instructions.

1

2 Answers 2

3

You can use shell expansions on the root document's absolute path to get its parent directory: "$(dirname ?ame")" (you need to execute this through a shell for expansions to work, e.g. sh -c 'my-command "$(dirname ?ame")"').

Use-case: this is what I do to use MikTeX on Ubuntu 22.04 through Docker in TeXstudio (see Support for Debian 11/Ubuntu 22.04 · Issue #1111 · MiKTeX/miktex and Dockerized MikTeX):

TeXstudio configuration

sh -c 'docker run --rm -v ~/.miktex/:/miktex/.miktex/ -v "$(dirname ?ame")":/miktex/work/ miktex/miktex:latest pdflatex "$(basename ?ame")"'
0

You can use ?a)

For example, I created a user command which copies the .bib file into the current directory as a user command. I used

/home/user/bin/copy_library ?a)

You must log in to answer this question.

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