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
5
  • For the second question, see Q50697. \input won't work because the internals of \usepackage aren't set up properly. Sep 10, 2022 at 1: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. Sep 10, 2022 at 7: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) Sep 10, 2022 at 8: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. Sep 10, 2022 at 8: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, 2022 at 10:51

1 Answer 1

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.

3
  • \usepackage{Style/amsmath} is really bad style and latex will warn about the incorrect use. Sep 10, 2022 at 8:28
  • Why is it bad use?, I'm not seeing any warning in the log. Sep 10, 2022 at 8:40
  • @AngelPeñaflor you should see a warning like LaTeX Warning: You have requested package `Style/amsmath', but the package provides `amsmath'. Sep 10, 2022 at 12:16

You must log in to answer this question.

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