Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I can't see any situation where I would want to compile a dvi file. Therefore I'd like to have latexmk default to giving me a pdf via pdflatex, so I don't have to type -pdf every time. I've tried adding the following to my latexmkrc file without success:

$print='pdf';

$pdflatex = 'pdflatex --shell-escape %O %S';

and even

$pdf=1

I'm on windows, so I can't just add it to my alias file. Is there a way to set up latexmk to make me a pdf unless I specify otherwise?

share|improve this question
4  
$pdf_mode = 1; !? –  Hans-Peter E. Kristiansen Jul 8 '13 at 22:34
    
@Hans-PeterE.Kristiansen Yep, that was it. Want to make that an answer? For the record: I feel dumb for missing that in the manual. –  Canageek Jul 8 '13 at 22:36
    
If you add -synctex=1' after %O %S, you can use forward and inverse search in your pdf viewer if it has that feature. –  dustin Jul 8 '13 at 22:49

1 Answer 1

up vote 9 down vote accepted

You need $pdf_mode = 1; to enable pdf mode. The manual says it is the same as the option:

...

Equivalent to the -pdf-, -pdf, -pdfdvi, -pdfps options.

A sensible place to store the configuration file is $HOME/.latexmkrc


Here is my complete .latexmkrc file:

$recorder = 1;
$pdf_mode = 1;
$bibtex_use = 2;
$pdflatex = "pdflatex --shell-escape %O %S";
$pdf_previewer = "start open -a preview %O %S";

add_cus_dep('glo', 'gls', 0, 'run_makeglossaries');
add_cus_dep('acn', 'acr', 0, 'run_makeglossaries');

sub run_makeglossaries {
  if ( $silent ) {
    system "makeglossaries -q '$_[0]'";
  }
  else {
    system "makeglossaries '$_[0]'";
  };
}

push @generated_exts, 'glo', 'gls', 'glg';
push @generated_exts, 'acn', 'acr', 'alg';
$clean_ext .= ' %R.ist %R.xdy';

For more latexmk example_rcfiles and extra-scripts :

http://ctan.org/tex-archive/support/latexmk/example_rcfiles

http://ctan.org/tex-archive/support/latexmk/extra-scripts

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.