C# and MikTeX

  • Thread starter Thread starter Azmat
  • Start date Start date
A

Azmat

Everyone,

i want to call MikTeX (http://miktex.org/) via some C# code in a
Windows APP. ANY HELP WOULD BE APPRECIATED!!! How exactly do I do
this and what do I need in order to do it?

thanks!

Azmat
 
I don't know MikTex but I gather it is an implementation of Latex on
Windows. My understanding is the way to interface with MikTex is to run the
command-line utilities (compilers, translators, etc) on documents. This is
at least how I used to use Latex, but this is going back 12 years so my
recollection may be wrong.

If this is so, then you can use System.Diagnostics.Process class to launch a
process.

<!--Start Fragment-->
private string RunProcess(string cmd) {
System.Diagnostics.Process p;
p= new System.Diagnostics.Process();
p.StartInfo.FileName= cmd;
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.Start();
// must have the readToEnd BEFORE the WaitForExit(), to avoid a deadlock
condition
string output= p.StandardOutput.ReadToEnd();
p.WaitForExit();
return output;
}

<!--End Fragment-->

check the doc here:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDiagnosticsProcessClassTopic.asp

to specify arguments to your command, you need to use the ProcessStartInfo
class in a way that is not illustrated above. See this doc for more:
http://msdn.microsoft.com/library/e...emDiagnosticsProcessStartInfoMembersTopic.asp

-Dino
 
Back
Top