0

It is possible to select where to save compiled pdfs from .tex files after compiling from the terminal. But, what commands in the preamble of a .tex file will give me explicit control over where the a compiled pdf will be saved after I have clicked the compile button?

Below is an arbitrary example. I am really just interested in how to specify the location the resulting pdf will be saved.

    \documentclass[12pt,a4paper]{article}
% For increasing size of page (margins)
\usepackage[bottom=1.5cm,top=1.5cm]{geometry}

% Increase space between caption and table
\usepackage{caption} 
\captionsetup[table]{skip=10pt}

\begin{document}
\begin{tabular}{SSSSSSSS} \toprule
{$m$} & {$\Re\{\underline{\mathfrak{X}}(m)\}$} & {$-\Im\{\underline{\mathfrak{X}}(m)\}$} & {$\mathfrak{X}(m)$} & {$\frac{\mathfrak{X}(m)}{23}$} & {$A_m$} & {$\varphi(m)\ /\ ^{\circ}$} & {$\varphi_m\ /\ ^{\circ}$} \\ \midrule
1  & 16.128 & +8.872 & 16.128 & 1.402 & 1.373 & -146.6 & -137.6 \\
2  & 3.442  & -2.509 & 3.442  & 0.299 & 0.343 & 133.2  & 152.4  \\
3  & 1.826  & -0.363 & 1.826  & 0.159 & 0.119 & 168.5  & -161.1 \\
4  & 0.993  & -0.429 & 0.993  & 0.086 & 0.08  & 25.6   & 90     \\ \midrule
5  & 1.29   & +0.099 & 1.29   & 0.112 & 0.097 & -175.6 & -114.7 \\
6  & 0.483  & -0.183 & 0.483  & 0.042 & 0.063 & 22.3   & 122.5  \\
7  & 0.766  & -0.475 & 0.766  & 0.067 & 0.039 & 141.6  & -122   \\
8  & 0.624  & +0.365 & 0.624  & 0.054 & 0.04  & -35.7  & 90     \\ \midrule
9  & 0.641  & -0.466 & 0.641  & 0.056 & 0.045 & 133.3  & -106.3 \\
10 & 0.45   & +0.421 & 0.45   & 0.039 & 0.034 & -69.4  & 110.9  \\
11 & 0.598  & -0.597 & 0.598  & 0.052 & 0.025 & 92.3   & -109.3 \\ \bottomrule

\end{tabular} \end{document}

Seems like a straight forward function but I have not found anything after hours of searching.

Nebulloyd
  • 101
  • 1
    you can't set that in the document, there are options on the command line to change the location, but better is some script which copies the pdf after the compilation. – Ulrike Fischer May 10 '22 at 07:22
  • How are you running pdflatex? Command line? If editor, which one? – Peter Grill May 10 '22 at 16:32
  • @PeterGrill I am currently running it through Rstudio – Nebulloyd May 11 '22 at 23:49
  • @Nebulloyd: Somewhere you must be specifying how to run pdflatex. Replace that with a script which runs that pdflatex -output-directory=<some/path> .... This should create all files in that directory. Then, if the pdf was created your script will need to move that to the approriate directory. But, note that the temporary files are often required for subsequent runs, so don't expect to be able to delete all the temporary files that are created. If you need to access that in the .tex file see Access value of -output-directory. – Peter Grill May 12 '22 at 02:34
  • @PeterGrill the command you posted looks like a unix (terminal) command correct? You may not be aware but RStudio can read and edit .tex files directly so I am trying to find a way that when I hit the 'compile' button it knows exactly where to place all the generated output files. Currently it just dumps them all in the same folder as the .tex file. I am actually looking for a way to set the output location IN the document not move it after the fact. It's true I could create a separate script that invokes system commands to run such a command but it seems superfluous to me... – Nebulloyd May 13 '22 at 04:59
  • Don't think you easily can do it in the document itself. it needs to be an option to pdflatex. Rstudio must have a perferences settings where you can pass options to pdflatex. There are several optons you can specify on the command line to control the executable. – Peter Grill May 14 '22 at 08:26

0 Answers0