# Using latexmk with multiple tex files in the directory

## edit

solution to compile :

latexmk -pdf mainfile.tex

I have left this example up as it might contain language used by others unfamiliar with this area :)

At the very least it provides a Minimal Working example of compiling a master file which includes a sub file, as well as a bibliography. All these are in the same directory for this example (I'm sure there are more pragmatic solutions to file management, "an exercise to the reader...").

Here is a bash alias that I use as I always have the main file called main.tex

# latex compile if files called main
alias ltmk="latexmk -bibtex -pdf -pvc ./main.tex"

I can't vouch for that being best practice - it works for me though.

I can compile a document using latexmk -pdf

If i have a tex file as a master that includes other tex files latexmk seems to get confused, I'm just wondering what the best practice is here?

I've tried to specify the master file with something like latexmk master.tex -pdf

thanks

Here's a MWE (I think!)

## Main File

\documentclass[11pt,a4paper,oneside]{book}
%------------------------------------------------------------
\usepackage[style=authoryear-comp]{biblatex}
%------------------------------------------------------------

\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{Something that I have written }\label{introduction}

This will be a citaion: \parencite{WinNT}
Here is another citation!(with parens) : \parencite{WinNT}
have another go \parencite{WinNT}

% this is the file that I would like to be input at this
% location
\input{test}

\backmatter

\printbibliography

\end{document}

## File to be included

\section{Something else}

This is something that's being included.

Can I still cite things from the bib file that's in the
directory?

Like \parencite{WinNT}

I'm not sure....

## Bib file

@online{WinNT,
author = {MultiMedia LLC},
title = {{MS Windows NT} Kernel Description},
year = 1999,
url = {http://web.archive.org/web/20080207010024/http://www.808multimedia.com/winnt/kernel.htm},
urldate = {2010-09-30}
}
• What about latexmk -pdf master.tex? You need to describe "get's confused" in more detail please :-) – darthbith Mar 17 '15 at 20:44
• i think you can probably substitute me for latex in that line, I'll try that now – baxx Mar 17 '15 at 20:45
• @darthbith that seems to be working fine, feeling suitably daft. Unless I hear otherwise I'll delete this post as Its probably not a common problem ;) – baxx Mar 17 '15 at 20:49
• Happens :-) If you think you can edit the post to be useful, please do so and provide a suitable answer! – darthbith Mar 17 '15 at 21:01
• @darthbith I'll try without saying 'don't be daft' ;) – baxx Mar 17 '15 at 21:13

$pdf_mode = 1;$dvi_mode = $postscript_mode = 0; As a bonus, I've added the second line so that just pdf files will be made, without the need to include -pdf on the command line, which I find convenient. • Is it possible to change latexmk configuration variables (e.g.$aux_dir) inside the command itself?. If yes, can you write down an example of working latexmk command including a definition of, for example, \$aux_dir? – Diaa Aug 12 '16 at 13:45