0

I have two questions. I'm writing my thesis and I have many files and several TikZ figures I've made. I see that if I use:

\usetikzlibrary{external}

my compilation time goes from 49.21s to 3.25s for the full document. The problem is that my working directory gets full of files I don't want to have there, basically what I want is for my directory to have the a structure something like this:

Thesis
│   main.pdf (The final pdf)
│   main.tex    
│
└───Chapters
│   
└───Figures (My TikZ files)
│   
└───Junk (The files produced by the compiler)
│   │   *.out
│   │   *.log
│   │   *.md5
│   │   *.pdf (The files produced by external)
│   │   ...
└───Style
│   │   *.sty

My questions are:

  1. How can I output every file to the Junk directory?
  2. Can I grab the style file if it's in another directory? For some reason \input{Style/style.sty} didn't work
  • For the second question, see Q50697. \input won't work because the internals of \usepackage aren't set up properly. – Qrrbrbirlbel Sep 10 '22 at 01:20
  • The "junk" contains important files needed for the next compilation and other tools, so it is no junk at all and it is normally not a good idea to move it out of the compilation folder. Use l3build or some makefile instead that copies all files into a build directory, compiles there and then copies the PDF back. – Ulrike Fischer Sep 10 '22 at 07:52
  • why call these "junk" ??? having the files is what speeds up the process. It will be possible to configure them to a subdirectory but massively complicates the process (as you need to configure everything to find them) – David Carlisle Sep 10 '22 at 08:28
  • Just because I don't like having a ton of files just being there. The answer below by Clara did help but I'm seeing that Ulrike is right, it does complicate things, for some reason when I try to compile everything trough a shell script something breaks and the compilation errors out. I'm happy enough not having 1k+ files in my working directory. – Angel Peñaflor Sep 10 '22 at 08:35
  • @AngelPeñaflor When some tikz codes don't need caching, you can use \tikzexternaldisable and \tikzexternalenable to mask caching. For example, when you use orcidlink package, because \orcidlink draws fast, there is no need to cache it. We can avoid caching a large number of orcidlink icons by patching, i.e., \xpretocmd{\orcidlink}{\tikzexternaldisable}{}{} and \xapptocmd{\orcidlink}{\tikzexternalenable}{}{}. If you use algpseudocodex package, you may need \BeforeBeginEnvironment{algorithmic}{\tikzexternaldisable} and \AfterEndEnvironment{algorithmic}{\tikzexternalenable}`. – Clara Sep 10 '22 at 10:51

1 Answers1

2

You can use \usepackage{Style/amsmath} if amsmath.sty is in Style folder.

You can use \tikzexternalize[prefix=Junk/] to set external cache folder, you need to manually create the Junk folder before the first time running the LaTeX.

Clara
  • 6,012