Created
November 19, 2012 02:10
-
-
Save zhuth/4108587 to your computer and use it in GitHub Desktop.
Run pdflatex, then bibtex, then pdflatex twice to get correct pdf output. Used for texworks. CsSC script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pdflatex = @"D:\Programs\CTEX\MiKTeX\miktex\bin\pdflatex.exe"; | |
var bibtex = @"D:\Programs\CTEX\MiKTeX\miktex\bin\bibtex.exe"; | |
string[] argpdf = new string[args.Length - 1]; | |
for (int i = 0; i < args.Length - 1; ++i) argpdf[i] = args[i]; | |
start(pdflatex, argpdf); | |
start(bibtex, new string[]{args[args.Length - 1]}); | |
start(pdflatex, argpdf); | |
start(pdflatex, argpdf); | |
#function | |
static void start(string cmd, string[] args) { | |
System.Diagnostics.Process process = new System.Diagnostics.Process(); | |
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); | |
startInfo.FileName = cmd; | |
startInfo.UseShellExecute = false; //not sure if this is absolutely required | |
//startInfo.RedirectStandardOuput = true; | |
string argsstr = ""; | |
foreach(string arg in args) argsstr += " " + arg; | |
argsstr = argsstr.Substring(1); | |
startInfo.Arguments = argsstr; | |
process.StartInfo = startInfo; | |
process.Start(); | |
process.WaitForExit(); | |
} | |
#endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment