latexmk -outdir with includebuild folder usage issueslatexmk - “(Pdf)Latex failed to generate the expected...

What to do when eye contact makes your coworker uncomfortable?

Which Article Helped Get Rid of Technobabble in RPGs?

Does the reader need to like the PoV character?

When were female captains banned from Starfleet?

How much theory knowledge is actually used while playing?

Has any country ever had 2 former presidents in jail simultaneously?

Is it necessary to use pronouns with the verb "essere"?

Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?

Review your own paper in Mathematics

Biological Blimps: Propulsion

Can I cause damage to electrical appliances by unplugging them when they are turned on?

Is it allowed to activate the ability of multiple planeswalkers in a single turn?

What kind of floor tile is this?

How to explain what's wrong with this application of the chain rule?

How to preserve electronics (computers, iPads and phones) for hundreds of years

Why do ¬, ∀ and ∃ have the same precedence?

Taxes on Dividends in a Roth IRA

Did the UK lift the requirement for registering SIM cards?

Why is it that I can sometimes guess the next note?

Can I say "fingers" when referring to toes?

Are Captain Marvel's powers affected by Thanos breaking the Tesseract and claiming the stone?

Doesn't the system of the Supreme Court oppose justice?

Short story about a deaf man, who cuts people tongues

Why does Carol not get rid of the Kree symbol on her suit when she changes its colours?



latexmk -outdir with include


build folder usage issueslatexmk - “(Pdf)Latex failed to generate the expected log file” when using -auxdir flagpdflatex and bblminted doesn't seem to use cache when outputdir option givenUsing output_dir with gnuplot fails to find .table fileSpecifying a path to imakeidxUse MiKTeX option through latexmkLaTeXmk, xelatex and TexmakerAUCTeX -output-directory + copy *.pdf to working directoryTexmaker bibtex works with input not with includeLatexmk - Non-existent destination filesthumbpdf support for latexmkPythontex and latexmklatexmk location of PDF outputWhich build system should I prefer if I want to distribute tex files?Errors with latexmk -c (cleanup) option













6















I'm trying to get latexmk to compile a .tex file with external include{...} references to a specific build directory so I don't pollute my directory tree with .aux files, etc.



However, it appears latexmk doesn't do as I'd expect when it compiles the included files. For example, consider a file file1.tex which has something like



%%%%%
include{chapters/test}
%%%%%


When I run



latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode -file-line-error" file1.tex


everything works fine, but



latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode -file-line-error" -outdir=build file1.tex


gives me the error



Latexmk: Missing input file: 'chapters/test.aux' from line
'No file chapters/test.aux.'


If I don't have the include statement, using input instead, everything compiles nicely to the build directory as you would expect.



For reference, I'm working on Mac OSX w/ MacTeX, as I understand there are a few differences in the implementation of latexmk between MacTeX and MikeTeX... any help would be much appreciated, as I've been beating my head against this for a while now.










share|improve this question




















  • 1





    you should never use the .tex extension when using include just use include{chapters/test}

    – David Carlisle
    Oct 12 '14 at 0:45











  • Ah yeah, you're right. FWIW, that just slipped in as I was typing the question, my actual source file just uses include{chapters/test} as you suggest! I updated the question accordingly :)

    – Neal Pisenti
    Oct 12 '14 at 1:32













  • OK in that case I'll retype the comment I started to type before spotting the .tex:-) 999 times out of 1000 if people configure tex to write files in non standard places they have problems, you need to configure tex, bibtex, makeindex, everything, to find the files and it's never worth it:-)

    – David Carlisle
    Oct 12 '14 at 1:35
















6















I'm trying to get latexmk to compile a .tex file with external include{...} references to a specific build directory so I don't pollute my directory tree with .aux files, etc.



However, it appears latexmk doesn't do as I'd expect when it compiles the included files. For example, consider a file file1.tex which has something like



%%%%%
include{chapters/test}
%%%%%


When I run



latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode -file-line-error" file1.tex


everything works fine, but



latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode -file-line-error" -outdir=build file1.tex


gives me the error



Latexmk: Missing input file: 'chapters/test.aux' from line
'No file chapters/test.aux.'


If I don't have the include statement, using input instead, everything compiles nicely to the build directory as you would expect.



For reference, I'm working on Mac OSX w/ MacTeX, as I understand there are a few differences in the implementation of latexmk between MacTeX and MikeTeX... any help would be much appreciated, as I've been beating my head against this for a while now.










share|improve this question




















  • 1





    you should never use the .tex extension when using include just use include{chapters/test}

    – David Carlisle
    Oct 12 '14 at 0:45











  • Ah yeah, you're right. FWIW, that just slipped in as I was typing the question, my actual source file just uses include{chapters/test} as you suggest! I updated the question accordingly :)

    – Neal Pisenti
    Oct 12 '14 at 1:32













  • OK in that case I'll retype the comment I started to type before spotting the .tex:-) 999 times out of 1000 if people configure tex to write files in non standard places they have problems, you need to configure tex, bibtex, makeindex, everything, to find the files and it's never worth it:-)

    – David Carlisle
    Oct 12 '14 at 1:35














6












6








6


4






I'm trying to get latexmk to compile a .tex file with external include{...} references to a specific build directory so I don't pollute my directory tree with .aux files, etc.



However, it appears latexmk doesn't do as I'd expect when it compiles the included files. For example, consider a file file1.tex which has something like



%%%%%
include{chapters/test}
%%%%%


When I run



latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode -file-line-error" file1.tex


everything works fine, but



latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode -file-line-error" -outdir=build file1.tex


gives me the error



Latexmk: Missing input file: 'chapters/test.aux' from line
'No file chapters/test.aux.'


If I don't have the include statement, using input instead, everything compiles nicely to the build directory as you would expect.



For reference, I'm working on Mac OSX w/ MacTeX, as I understand there are a few differences in the implementation of latexmk between MacTeX and MikeTeX... any help would be much appreciated, as I've been beating my head against this for a while now.










share|improve this question
















I'm trying to get latexmk to compile a .tex file with external include{...} references to a specific build directory so I don't pollute my directory tree with .aux files, etc.



However, it appears latexmk doesn't do as I'd expect when it compiles the included files. For example, consider a file file1.tex which has something like



%%%%%
include{chapters/test}
%%%%%


When I run



latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode -file-line-error" file1.tex


everything works fine, but



latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode -file-line-error" -outdir=build file1.tex


gives me the error



Latexmk: Missing input file: 'chapters/test.aux' from line
'No file chapters/test.aux.'


If I don't have the include statement, using input instead, everything compiles nicely to the build directory as you would expect.



For reference, I'm working on Mac OSX w/ MacTeX, as I understand there are a few differences in the implementation of latexmk between MacTeX and MikeTeX... any help would be much appreciated, as I've been beating my head against this for a while now.







include latexmk






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 12 '14 at 1:32







Neal Pisenti

















asked Oct 12 '14 at 0:34









Neal PisentiNeal Pisenti

1314




1314








  • 1





    you should never use the .tex extension when using include just use include{chapters/test}

    – David Carlisle
    Oct 12 '14 at 0:45











  • Ah yeah, you're right. FWIW, that just slipped in as I was typing the question, my actual source file just uses include{chapters/test} as you suggest! I updated the question accordingly :)

    – Neal Pisenti
    Oct 12 '14 at 1:32













  • OK in that case I'll retype the comment I started to type before spotting the .tex:-) 999 times out of 1000 if people configure tex to write files in non standard places they have problems, you need to configure tex, bibtex, makeindex, everything, to find the files and it's never worth it:-)

    – David Carlisle
    Oct 12 '14 at 1:35














  • 1





    you should never use the .tex extension when using include just use include{chapters/test}

    – David Carlisle
    Oct 12 '14 at 0:45











  • Ah yeah, you're right. FWIW, that just slipped in as I was typing the question, my actual source file just uses include{chapters/test} as you suggest! I updated the question accordingly :)

    – Neal Pisenti
    Oct 12 '14 at 1:32













  • OK in that case I'll retype the comment I started to type before spotting the .tex:-) 999 times out of 1000 if people configure tex to write files in non standard places they have problems, you need to configure tex, bibtex, makeindex, everything, to find the files and it's never worth it:-)

    – David Carlisle
    Oct 12 '14 at 1:35








1




1





you should never use the .tex extension when using include just use include{chapters/test}

– David Carlisle
Oct 12 '14 at 0:45





you should never use the .tex extension when using include just use include{chapters/test}

– David Carlisle
Oct 12 '14 at 0:45













Ah yeah, you're right. FWIW, that just slipped in as I was typing the question, my actual source file just uses include{chapters/test} as you suggest! I updated the question accordingly :)

– Neal Pisenti
Oct 12 '14 at 1:32







Ah yeah, you're right. FWIW, that just slipped in as I was typing the question, my actual source file just uses include{chapters/test} as you suggest! I updated the question accordingly :)

– Neal Pisenti
Oct 12 '14 at 1:32















OK in that case I'll retype the comment I started to type before spotting the .tex:-) 999 times out of 1000 if people configure tex to write files in non standard places they have problems, you need to configure tex, bibtex, makeindex, everything, to find the files and it's never worth it:-)

– David Carlisle
Oct 12 '14 at 1:35





OK in that case I'll retype the comment I started to type before spotting the .tex:-) 999 times out of 1000 if people configure tex to write files in non standard places they have problems, you need to configure tex, bibtex, makeindex, everything, to find the files and it's never worth it:-)

– David Carlisle
Oct 12 '14 at 1:35










3 Answers
3






active

oldest

votes


















9














Actually, this isn't a latexmk problem. If you look at the .log file or at the actual screen output, you'll see that it is pdflatex that had a problem. If you run pdflatex from the command line with the -output-directory=build option, you will get exactly the same errors. The primary error is that pdflatex can't create the file chapters/test.aux.



The solution is simply to create a chapters subdirectory of your build directory.



(The messages you saw from latexmk are its summary of what it is currently programmed to treat as common significant warnings and errors. But it's an incomplete summary. In general, if you find an error and don't understand what to do about it, it's worth going through the .log file; that provides much more information than latexmk's summary.)






share|improve this answer



















  • 3





    This sure sounds like a bug in pdflatex (not creating directories when they don't exist).

    – BenC
    May 4 '15 at 2:41











  • To programmatically mirror the directory structure, you can add a line like system ("find . -type d ! -path './.git*' ! -path './$out_dir*' -exec mkdir -p $out_dir/{} \;"); (which is just the approximately appropriate shell command wrapped in Perl's system call) after the definition of $out_dir = <...> in your local .latexmkrc file. Probably not a good idea for a global .latexmkrc, though - otherwise beware of that quick latexmk test.tex in your home directory. I agree that this is just a workaround, and a proper solution would require pdflatex to handle that situation gracefully.

    – akobel
    May 24 '16 at 21:26





















1














As @john-collins wrote above, this is not an issue in latexmk but in your tex interpreter like pdflatex.



Another solution to your problem is redefining the include command to create the output dir before actually executing include.



My implementation in lualatex:



ifluatex%
directlua{%
function makeparentdirs(path_with_filename)
local mkdirp = require('mkdirp_lua/mkdirp')
mkdirp(path_with_filename)

require('lfs')
% -- delete lowest directory which collides with file name
if lfs.attributes(path_with_filename).mode == 'directory' then
lfs.rmdir(path_with_filename)
end
end
}%
fi

letOLDincludeinclude
renewcommand{include}[1]{%
ifluatex%
directlua{makeparentdirs(luastring{auxdirname} .. '/' .. luastring{#1})}%
fi%
OLDinclude{#1}%
}


This solution is not nice though, because:




  • depending on both platform and command line switches, the directory for aux files may differ. You have to manually define it by running newcommand*{auxdirname}{auxdir} or similar before.

  • it depends on a separate lua library from https://github.com/xpol/mkdirp.lua


This solution works fine with tikz' external library, which also requires the folders in outdir/auxdir to be created when using custom (not auto-numerated) directories.






share|improve this answer































    0














    I also got these errors, when using the doincludeonly from https://en.wikibooks.org/wiki/TeX/includeonly On this case, these errors can be safely ignored.



    But, if you would like, you can make latex stop generate these errors, if you generate a full version of the document, before using the doincludeonly commands.



    Then, on the next times, it will not throw the errors until you clear your latex cache of the files.





    share























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "85"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f206695%2flatexmk-outdir-with-include%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      9














      Actually, this isn't a latexmk problem. If you look at the .log file or at the actual screen output, you'll see that it is pdflatex that had a problem. If you run pdflatex from the command line with the -output-directory=build option, you will get exactly the same errors. The primary error is that pdflatex can't create the file chapters/test.aux.



      The solution is simply to create a chapters subdirectory of your build directory.



      (The messages you saw from latexmk are its summary of what it is currently programmed to treat as common significant warnings and errors. But it's an incomplete summary. In general, if you find an error and don't understand what to do about it, it's worth going through the .log file; that provides much more information than latexmk's summary.)






      share|improve this answer



















      • 3





        This sure sounds like a bug in pdflatex (not creating directories when they don't exist).

        – BenC
        May 4 '15 at 2:41











      • To programmatically mirror the directory structure, you can add a line like system ("find . -type d ! -path './.git*' ! -path './$out_dir*' -exec mkdir -p $out_dir/{} \;"); (which is just the approximately appropriate shell command wrapped in Perl's system call) after the definition of $out_dir = <...> in your local .latexmkrc file. Probably not a good idea for a global .latexmkrc, though - otherwise beware of that quick latexmk test.tex in your home directory. I agree that this is just a workaround, and a proper solution would require pdflatex to handle that situation gracefully.

        – akobel
        May 24 '16 at 21:26


















      9














      Actually, this isn't a latexmk problem. If you look at the .log file or at the actual screen output, you'll see that it is pdflatex that had a problem. If you run pdflatex from the command line with the -output-directory=build option, you will get exactly the same errors. The primary error is that pdflatex can't create the file chapters/test.aux.



      The solution is simply to create a chapters subdirectory of your build directory.



      (The messages you saw from latexmk are its summary of what it is currently programmed to treat as common significant warnings and errors. But it's an incomplete summary. In general, if you find an error and don't understand what to do about it, it's worth going through the .log file; that provides much more information than latexmk's summary.)






      share|improve this answer



















      • 3





        This sure sounds like a bug in pdflatex (not creating directories when they don't exist).

        – BenC
        May 4 '15 at 2:41











      • To programmatically mirror the directory structure, you can add a line like system ("find . -type d ! -path './.git*' ! -path './$out_dir*' -exec mkdir -p $out_dir/{} \;"); (which is just the approximately appropriate shell command wrapped in Perl's system call) after the definition of $out_dir = <...> in your local .latexmkrc file. Probably not a good idea for a global .latexmkrc, though - otherwise beware of that quick latexmk test.tex in your home directory. I agree that this is just a workaround, and a proper solution would require pdflatex to handle that situation gracefully.

        – akobel
        May 24 '16 at 21:26
















      9












      9








      9







      Actually, this isn't a latexmk problem. If you look at the .log file or at the actual screen output, you'll see that it is pdflatex that had a problem. If you run pdflatex from the command line with the -output-directory=build option, you will get exactly the same errors. The primary error is that pdflatex can't create the file chapters/test.aux.



      The solution is simply to create a chapters subdirectory of your build directory.



      (The messages you saw from latexmk are its summary of what it is currently programmed to treat as common significant warnings and errors. But it's an incomplete summary. In general, if you find an error and don't understand what to do about it, it's worth going through the .log file; that provides much more information than latexmk's summary.)






      share|improve this answer













      Actually, this isn't a latexmk problem. If you look at the .log file or at the actual screen output, you'll see that it is pdflatex that had a problem. If you run pdflatex from the command line with the -output-directory=build option, you will get exactly the same errors. The primary error is that pdflatex can't create the file chapters/test.aux.



      The solution is simply to create a chapters subdirectory of your build directory.



      (The messages you saw from latexmk are its summary of what it is currently programmed to treat as common significant warnings and errors. But it's an incomplete summary. In general, if you find an error and don't understand what to do about it, it's worth going through the .log file; that provides much more information than latexmk's summary.)







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Oct 13 '14 at 18:40









      John CollinsJohn Collins

      7,0101825




      7,0101825








      • 3





        This sure sounds like a bug in pdflatex (not creating directories when they don't exist).

        – BenC
        May 4 '15 at 2:41











      • To programmatically mirror the directory structure, you can add a line like system ("find . -type d ! -path './.git*' ! -path './$out_dir*' -exec mkdir -p $out_dir/{} \;"); (which is just the approximately appropriate shell command wrapped in Perl's system call) after the definition of $out_dir = <...> in your local .latexmkrc file. Probably not a good idea for a global .latexmkrc, though - otherwise beware of that quick latexmk test.tex in your home directory. I agree that this is just a workaround, and a proper solution would require pdflatex to handle that situation gracefully.

        – akobel
        May 24 '16 at 21:26
















      • 3





        This sure sounds like a bug in pdflatex (not creating directories when they don't exist).

        – BenC
        May 4 '15 at 2:41











      • To programmatically mirror the directory structure, you can add a line like system ("find . -type d ! -path './.git*' ! -path './$out_dir*' -exec mkdir -p $out_dir/{} \;"); (which is just the approximately appropriate shell command wrapped in Perl's system call) after the definition of $out_dir = <...> in your local .latexmkrc file. Probably not a good idea for a global .latexmkrc, though - otherwise beware of that quick latexmk test.tex in your home directory. I agree that this is just a workaround, and a proper solution would require pdflatex to handle that situation gracefully.

        – akobel
        May 24 '16 at 21:26










      3




      3





      This sure sounds like a bug in pdflatex (not creating directories when they don't exist).

      – BenC
      May 4 '15 at 2:41





      This sure sounds like a bug in pdflatex (not creating directories when they don't exist).

      – BenC
      May 4 '15 at 2:41













      To programmatically mirror the directory structure, you can add a line like system ("find . -type d ! -path './.git*' ! -path './$out_dir*' -exec mkdir -p $out_dir/{} \;"); (which is just the approximately appropriate shell command wrapped in Perl's system call) after the definition of $out_dir = <...> in your local .latexmkrc file. Probably not a good idea for a global .latexmkrc, though - otherwise beware of that quick latexmk test.tex in your home directory. I agree that this is just a workaround, and a proper solution would require pdflatex to handle that situation gracefully.

      – akobel
      May 24 '16 at 21:26







      To programmatically mirror the directory structure, you can add a line like system ("find . -type d ! -path './.git*' ! -path './$out_dir*' -exec mkdir -p $out_dir/{} \;"); (which is just the approximately appropriate shell command wrapped in Perl's system call) after the definition of $out_dir = <...> in your local .latexmkrc file. Probably not a good idea for a global .latexmkrc, though - otherwise beware of that quick latexmk test.tex in your home directory. I agree that this is just a workaround, and a proper solution would require pdflatex to handle that situation gracefully.

      – akobel
      May 24 '16 at 21:26













      1














      As @john-collins wrote above, this is not an issue in latexmk but in your tex interpreter like pdflatex.



      Another solution to your problem is redefining the include command to create the output dir before actually executing include.



      My implementation in lualatex:



      ifluatex%
      directlua{%
      function makeparentdirs(path_with_filename)
      local mkdirp = require('mkdirp_lua/mkdirp')
      mkdirp(path_with_filename)

      require('lfs')
      % -- delete lowest directory which collides with file name
      if lfs.attributes(path_with_filename).mode == 'directory' then
      lfs.rmdir(path_with_filename)
      end
      end
      }%
      fi

      letOLDincludeinclude
      renewcommand{include}[1]{%
      ifluatex%
      directlua{makeparentdirs(luastring{auxdirname} .. '/' .. luastring{#1})}%
      fi%
      OLDinclude{#1}%
      }


      This solution is not nice though, because:




      • depending on both platform and command line switches, the directory for aux files may differ. You have to manually define it by running newcommand*{auxdirname}{auxdir} or similar before.

      • it depends on a separate lua library from https://github.com/xpol/mkdirp.lua


      This solution works fine with tikz' external library, which also requires the folders in outdir/auxdir to be created when using custom (not auto-numerated) directories.






      share|improve this answer




























        1














        As @john-collins wrote above, this is not an issue in latexmk but in your tex interpreter like pdflatex.



        Another solution to your problem is redefining the include command to create the output dir before actually executing include.



        My implementation in lualatex:



        ifluatex%
        directlua{%
        function makeparentdirs(path_with_filename)
        local mkdirp = require('mkdirp_lua/mkdirp')
        mkdirp(path_with_filename)

        require('lfs')
        % -- delete lowest directory which collides with file name
        if lfs.attributes(path_with_filename).mode == 'directory' then
        lfs.rmdir(path_with_filename)
        end
        end
        }%
        fi

        letOLDincludeinclude
        renewcommand{include}[1]{%
        ifluatex%
        directlua{makeparentdirs(luastring{auxdirname} .. '/' .. luastring{#1})}%
        fi%
        OLDinclude{#1}%
        }


        This solution is not nice though, because:




        • depending on both platform and command line switches, the directory for aux files may differ. You have to manually define it by running newcommand*{auxdirname}{auxdir} or similar before.

        • it depends on a separate lua library from https://github.com/xpol/mkdirp.lua


        This solution works fine with tikz' external library, which also requires the folders in outdir/auxdir to be created when using custom (not auto-numerated) directories.






        share|improve this answer


























          1












          1








          1







          As @john-collins wrote above, this is not an issue in latexmk but in your tex interpreter like pdflatex.



          Another solution to your problem is redefining the include command to create the output dir before actually executing include.



          My implementation in lualatex:



          ifluatex%
          directlua{%
          function makeparentdirs(path_with_filename)
          local mkdirp = require('mkdirp_lua/mkdirp')
          mkdirp(path_with_filename)

          require('lfs')
          % -- delete lowest directory which collides with file name
          if lfs.attributes(path_with_filename).mode == 'directory' then
          lfs.rmdir(path_with_filename)
          end
          end
          }%
          fi

          letOLDincludeinclude
          renewcommand{include}[1]{%
          ifluatex%
          directlua{makeparentdirs(luastring{auxdirname} .. '/' .. luastring{#1})}%
          fi%
          OLDinclude{#1}%
          }


          This solution is not nice though, because:




          • depending on both platform and command line switches, the directory for aux files may differ. You have to manually define it by running newcommand*{auxdirname}{auxdir} or similar before.

          • it depends on a separate lua library from https://github.com/xpol/mkdirp.lua


          This solution works fine with tikz' external library, which also requires the folders in outdir/auxdir to be created when using custom (not auto-numerated) directories.






          share|improve this answer













          As @john-collins wrote above, this is not an issue in latexmk but in your tex interpreter like pdflatex.



          Another solution to your problem is redefining the include command to create the output dir before actually executing include.



          My implementation in lualatex:



          ifluatex%
          directlua{%
          function makeparentdirs(path_with_filename)
          local mkdirp = require('mkdirp_lua/mkdirp')
          mkdirp(path_with_filename)

          require('lfs')
          % -- delete lowest directory which collides with file name
          if lfs.attributes(path_with_filename).mode == 'directory' then
          lfs.rmdir(path_with_filename)
          end
          end
          }%
          fi

          letOLDincludeinclude
          renewcommand{include}[1]{%
          ifluatex%
          directlua{makeparentdirs(luastring{auxdirname} .. '/' .. luastring{#1})}%
          fi%
          OLDinclude{#1}%
          }


          This solution is not nice though, because:




          • depending on both platform and command line switches, the directory for aux files may differ. You have to manually define it by running newcommand*{auxdirname}{auxdir} or similar before.

          • it depends on a separate lua library from https://github.com/xpol/mkdirp.lua


          This solution works fine with tikz' external library, which also requires the folders in outdir/auxdir to be created when using custom (not auto-numerated) directories.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 24 '18 at 7:36









          genodeftestgenodeftest

          1207




          1207























              0














              I also got these errors, when using the doincludeonly from https://en.wikibooks.org/wiki/TeX/includeonly On this case, these errors can be safely ignored.



              But, if you would like, you can make latex stop generate these errors, if you generate a full version of the document, before using the doincludeonly commands.



              Then, on the next times, it will not throw the errors until you clear your latex cache of the files.





              share




























                0














                I also got these errors, when using the doincludeonly from https://en.wikibooks.org/wiki/TeX/includeonly On this case, these errors can be safely ignored.



                But, if you would like, you can make latex stop generate these errors, if you generate a full version of the document, before using the doincludeonly commands.



                Then, on the next times, it will not throw the errors until you clear your latex cache of the files.





                share


























                  0












                  0








                  0







                  I also got these errors, when using the doincludeonly from https://en.wikibooks.org/wiki/TeX/includeonly On this case, these errors can be safely ignored.



                  But, if you would like, you can make latex stop generate these errors, if you generate a full version of the document, before using the doincludeonly commands.



                  Then, on the next times, it will not throw the errors until you clear your latex cache of the files.





                  share













                  I also got these errors, when using the doincludeonly from https://en.wikibooks.org/wiki/TeX/includeonly On this case, these errors can be safely ignored.



                  But, if you would like, you can make latex stop generate these errors, if you generate a full version of the document, before using the doincludeonly commands.



                  Then, on the next times, it will not throw the errors until you clear your latex cache of the files.






                  share











                  share


                  share










                  answered 3 mins ago









                  useruser

                  1,2402929




                  1,2402929






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f206695%2flatexmk-outdir-with-include%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      El tren de la libertad Índice Antecedentes "Porque yo decido" Desarrollo de la...

                      Castillo d'Acher Características Menú de navegación

                      Connecting two nodes from the same mother node horizontallyTikZ: What EXACTLY does the the |- notation for...