# Parentheses disappear in Equation mode in ACM class

The problem is that when using the font package lmodern with the ACM class acmart.cls, the parentheses tend to disappear in the final output. Without lmodern, acmart.cls gives an error. Here is the MWE:

\documentclass[sigconf, anonymous=true]{acmart}
\usepackage{lmodern}

\begin{document}

\title[XYZ]{XYZ}

\maketitle
$$Output = AES_{K}(0),AES_{K}(1),AES_{K}(2),...$$
%
\bibliographystyle{ACM-Reference-Format}
\bibliography{PRNGbib}
\end{document}


I am using a lot of other math packages too. Both parentheses and curly brackets tend to disappear in the final output as shown below:

• You shouldn't load font packages with acmart. – egreg Mar 5 '18 at 17:48
• The acmart document class loads the libertine text font package and the newtxmath math font package (with option libertine). You should under no circumstance be loading the lmodern font package while using the acmart document class. If, for some reason, you simply must use the lmodern font package, don't use the acmart document class. Incidentally, I get no error or warning message when running your code without the instruction \usepackage{lmodern}. Which TeX distribution do you employ? – Mico Mar 5 '18 at 17:59
• @Mico: I am using MiKTeX. I have enhanced the MWE to include the document title part now and commenting the package lmodern gives me this error "pdftex error (font expansion): auto expansion is only possible with scalabale fonts". – Azuru Mar 6 '18 at 19:37
• Something must have gone wrong during the MikTeX installation process on your machine. I tried your code (with and without the \usepackage{lmodern} directive) on both a MikteX2.9 and a MacTeX2017 system and am unable to produce any error messages. Sorry. – Mico Mar 6 '18 at 21:48
• @Mico: That's strange. One more thing which popped up recently is that if you comment the title part along with the lmodern package, no output pdf output is produced i.e. 0 pages. Though the compiler doesn't gives an error, the log file do mentions this error "!pdfTeX error: pdflatex.exe (file LinLibertineT-tlf-ot1--base): Font LinLibertineT-tlf-ot1--base at 360 not found ==> Fatal error occurred, no output PDF file produced!". So as you already suggested this seems to be a case of some components missing from the underlying libertine font package. – Azuru Mar 7 '18 at 0:01

You get warnings in your log file:

Missing character: There is no <B9> in font lmsy9!
Missing character: There is no <B9> in font lmsy9!
Missing character: There is no <BA> in font lmsy9!
Missing character: There is no <B9> in font lmsy9!
Missing character: There is no <BA> in font lmsy9!
Missing character: There is no <B9> in font lmsy9!
Missing character: There is no <BA> in font lmsy9!


(the actual output may differ in how it displays <B9> and <BA>).

The problem is that the acmart document class loads newtxmath with the option libertine, which assigns different mathcodes to ( and ), precisely "42B9 for ) and 52BA for ) and this explains the “missing character” warnings.

The standard mathcodes are, respectively, "4028 and "5029. You might get away with such problems by redefining the mathcodes:

\DeclareMathDelimiter{(}{\mathopen} {operators}{"28}{largesymbols}{"00}
\DeclareMathDelimiter{)}{\mathclose}{operators}{"29}{largesymbols}{"01}


Here's the complete code:

\documentclass[sigconf, anonymous=true]{acmart}
\usepackage{lmodern}

\DeclareMathDelimiter{(}{\mathopen} {operators}{"28}{largesymbols}{"00}
\DeclareMathDelimiter{)}{\mathclose}{operators}{"29}{largesymbols}{"01}

\begin{document}

\title[XYZ]{XYZ}

\maketitle
$$Output = AES_{K}(0),AES_{K}(1),AES_{K}(2),...$$

\bibliographystyle{ACM-Reference-Format}
\bibliography{PRNGbib}

\end{document}


Note, however, that it's possible to have other mismatches between the defined mathcodes and those expected by lmodern. Also some parts of the document may use Libertine nonetheless.

Final advice: the acmart class has been carefully written to comply with the standards of ACM and affiliate conferences. Changing the appearance of the output by loading different fonts than what's defined in the class should not be done and it could be a good reason for rejection of a submission.

• Thanks for the advice. Certainly, I will not like to do that but can't help it. Without loading lmodern I get errors with acmart class upon compiling. – Azuru Jan 18 '19 at 17:09

The OP's problem is different, but anyone trying to use lmodern and newtxmath together is likely to encounter the same symptoms, independent of the acmart class. In my case I was using newtxmath just for a few symbols, and the solution that worked best was to stop loading that package and instead copy out the definitions of symbols I needed from newtxmath.sty. For example (obviously this will vary depending on which symbols you need):

% from <https://tex.stackexchange.com/q/452081/78411>
\makeatletter
\newif\iftx@libertine
\newif\iftx@minion
\newif\iftx@coch
\newif\iftx@ch
\newif\iftx@stxtwo
\makeatother

\DeclareSymbolFont{lettersA}{U}{ntxmia}{m}{it}
\SetSymbolFont{lettersA}{bold}{U}{ntxmia}{b}{it}
\DeclareFontSubstitution{U}{ntxmia}{m}{it}

\DeclareMathSymbol{\uprho}{\mathord}{lettersA}{26}
\DeclareMathSymbol{\upvarphi}{\mathord}{lettersA}{39}

\DeclareSymbolFont{AMSm}{U}{ntxsym}{m}{n}
\SetSymbolFont{AMSm}{bold}{U}{ntxsym}{b}{n}
\DeclareFontSubstitution{U}{ntxsym}{m}{n}

\DeclareMathSymbol{\Game}{\mathord}{AMSm}{97}
\DeclareMathSymbol{\ggg}{\mathrel}{AMSm}{239}
\DeclareMathSymbol{\circledast}{\mathbin}{AMSm}{254}