Include *.sty file from a super/subdirectory of main *.tex file

后端 未结 5 1921
滥情空心
滥情空心 2021-01-31 15:58

I want to share a latex document via git with many other people. Therefore we decided to put all the special sty files, that are not present in everyones latex-installation, in

5条回答
  •  遇见更好的自我
    2021-01-31 16:14

    You can use latexmk and its facilities

    There is a feature documented under Utility subroutines on page 48 here in latexmk which can update TEXINPUTS during a run. If you can consider to use the .latexmkrc file to configure your chain and options, you can add ensure_path() to the file:

    Here is an example:

    # .latexmkrc
    ensure_path('TEXINPUTS', './path/to/something//', '/full/path/to/something/else//')
    # [...] Other options goes here.
    $pdf_update_method = 3;
    $xelatex = 'xelatex -synctex=1 -interaction=nonstopmode -file-line-error %O %S';
    $pdf_previewer = 'start "%ProgramFiles%/SumatraPDF/SumatraPDF.exe" %O %S';
    $out_dir = 'build/';
    

    Notice the // at the end of a path, This will aid LaTeX to search for files in the specified directory and in all subdirectories.

    Please note that while this is an amazing feature, you need to take good care of your naming scheme. If you use the same file name several places, you can run into trouble when importing them with, say \include{somefile}.

提交回复
热议问题