![](/img/trans.png)
[英]utf8 codification problem C#, writing a tex file, and compiling with pdflatex
[英]Compile a .tex file in C#
我正在制作.bat文件以將.tex文件編譯為pdf,當我直接運行.bat文件時,它可以正常工作,但是當我在c#中運行它時,出現錯誤“ pdflatex:無效參數”
static void ExecuteCommand()
{
Process p1 = new Process();
p1.StartInfo.FileName = @"c:\users\miguelangel\documents\visual studio 2013\Projects\PruebaLatex\PruebaLatex\batch.bat";
p1.StartInfo.Arguments =@"c:\users\miguelangel\documents\visual studio 2013\Projects\PruebaLatex\PruebaLatex\prueba.tex";
p1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p1.StartInfo.RedirectStandardOutput = true;
p1.StartInfo.UseShellExecute = false;
try
{
p1.Start();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
請幫助我:(,我不知道該怎么辦,這是.bat文件
pdflatex prueba.tex
暫停
由於目錄名稱中有空格,因此需要將其括在引號中
p1.StartInfo.FileName = @"\"c:\users\miguelangel\documents\visual studio 2013\Projects\PruebaLatex\PruebaLatex\batch.bat\"";
p1.StartInfo.Arguments =@"\"c:\users\miguelangel\documents\visual studio 2013\Projects\PruebaLatex\PruebaLatex\prueba.tex\"";
或者,在運行之前,將工作目錄更改為c:\\ users \\ miguelangel \\ documents \\ visual studio 2013 \\ Projects \\ PruebaLatex \\ PruebaLatex 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.