0

I'm trying to change the default compiler to store a copy of the .pdf in a different folder, with the path based off of the directory of the .tex file.

I am making slides for a class, and for a number of reasons, it's necessary for me to name all of the beamer files "beamer.tex," and sort them into files with the name of the section. For example, I have

MATH115\slides\Chapter 5\beamer.tex

I want TexStudio to copy the .pdf to a shared drive. I entered the following user command:

USER COMMAND: cmd /C copy / %.pdf C:\Users\user\Dropbox\Shared\

and this works quite well, but realized that when I compile these particular slides, everything will be named "beamer.pdf." I was hoping someone knew if there was a way to include the directory of the .tex file in this command, so that each copied file would end up in its own folder on the shared drive, ideally I would like the .pdf to end up in

C:\Users\user\Dropbox\SharedSlides(variable folder name)\%.pdf

Even better, it would be nice if I could just have the pdf itself have a name based on the directory, so all of the slides end up in one folder.

5
  • 4
    Naming any file the same as a package or class but with extension .tex is a recipe for disaster
    – Joseph Wright
    Sep 3, 2019 at 11:47
  • Welcome to TeX.SE. So in essence, you want to get the name of the current folder and put the result into your copy command, is that correct? So your new command would be something like cmd /C copy %.pdf C:\Users\user\Dropbox\SharedSlides(current folder name)\%.pdf? Sep 3, 2019 at 11:52
  • Yes LokiRagnarok. That exactly, or even better, if the current folder name could be incorporated into the name of the pdf file, so that they can all be in the same folder.
    – dr.bobby
    Sep 4, 2019 at 16:40
  • You seem to seek a sequence of commands for obtaining the name of the current directory. These commands will be passed to the shell/command-prompt by the program TeXStudio. Thus these commands a) are not related to (La)TeX but to using a shell or the command-prompt b) are platform dependent. In order to provide help information is needed on what operating system and what shell/command-prompt is in use. As you use TeXStudio (-> some GUI needed) and the copy command and `\` for separating directory names in file paths I guess that some Microsoft Windows operating system is in use. Sep 4, 2019 at 21:24
  • Perhaps this is of interest: Get parent directory name for a particular file using DOS Batch scripting Sep 4, 2019 at 21:37

0

You must log in to answer this question.

Browse other questions tagged .