0

This question is a variation of this.

In my case, the command has an argument. For example, suppose I processing sample.tex with texlive, to generate a dvi, ps and pdf respectively. The commands will be

latex sample.tex
bibtex sample.aux
latex samlpe.tex
dvips sample.dvi
ps2pdf sample.ps 

Can I merge them together to a script file so that whenever I enter

makepdf sample.tex

all the above commands are executed sequentially, so that I get a pdf.

Community
  • 1
  • 1
Della
  • 1,264
  • 2
  • 15
  • 32

2 Answers2

1

This file is makepdf.bat:

@echo off
latex %1
bibtex %~N1.aux
latex %1
dvips %~N1.dvi
ps2pdf %~N1.ps 

Execute it as you said before:

makepdf sample.tex
Aacini
  • 65,180
  • 12
  • 72
  • 108
  • Thanks, but this is not working. When I use the set of commands, it the terminal says 'entering extended mode' and freezes there. But it works fine if I just replace the arguments with actual file names. Can you point me to some reference which explains the arguments? – Della Jan 20 '14 at 04:23
0

This is the same as aacini's code but it also supports long filename elements.

@echo off
latex  "%~1"
bibtex "%~n1.aux"
latex  "%~1"
dvips  "%~n1.dvi"
ps2pdf "%~n1.ps"

If any of the commands are batch files then add a call keyword before the command name.

foxidrive
  • 40,353
  • 10
  • 53
  • 68