[Tex/LaTex] Using PDFLaTeX inside C# .Net code does not load some math symbols

math-modemiktexpdftextex-core

On my Windows 8.1 with MikTeK installed, the following C# code successfully generates a PDF file with Math expressions except for some Unicode codes such as plusminus sign:

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = false;
startInfo.FileName = "pdflatex.exe";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = Test.tex;

For example, in my tex file I've two math expressions one \sqrt{2} with square root symbol and one a\unicode{177}b with plusminus sign. The above code correctly displays square root sign in the resulting PDF file but the expression with plusminus sign displays as a<177>b. The error shown in the corresponding Test.log file generated by MikTeK is shown below. The error is UC: bad: 177. The same tex file correctly displays math expressions when directly using the DOS command in Windows as pdflatex Test.tex:

LaTeX Font Info:    Try loading font information for U+msa on input line 19.
("C:\Program Files (x86)\MikTeX\tex\latex\amsfonts\umsa.fd"
File: umsa.fd 2013/01/14 v3.01 AMS symbols A
)
LaTeX Font Info:    Try loading font information for U+msb on input line 19.

("C:\Program Files (x86)\MikTeX\tex\latex\amsfonts\umsb.fd"
File: umsb.fd 2013/01/14 v3.01 AMS symbols B
)
UC: bad: 177
[1....

UPDATE
I'm using a tex file generated via David's stylesheet. The entire content of the file is:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{pmml-new}
\begin{document}

 \(\let\par\empty

a\unicode{177}b

\)

\end{document}

When using pdflatex inside C# code (shown above) I get the following pdf: enter image description here. But the same tex file correctly generates the pdf shown below when using the command pdflatex Test.tex in the DOS window or when using TeXworks editor: enter image description here

Best Answer

You did not say but this is pmml-new.sty which sets up a mechanism to declare behaviour for unicode characters but leaves most undefined. You need to define 177 as \pm so

 \@namedef{uc177}{\pm}

should define this character.