繁体   English   中英

在C#中编译.tex文件

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM