# always upright parenthesises and brackets

I was suggested by my thesis referee that parenthesizes () and citation brackets [] (I only use square brackets generated by biblatex)should always be in upright.

This is indeed the same question as Upright parentheses in italic text and How to get upright parentheses in the whole document?.

But the solution (embrac) there is not fully satisfactory. First, it produces errors for \emph{$$math$$ not work!}; second, it does not work for italic texts in theorem environment.

Since this is a style problem, I hope that there is no need to modify the code of the main file manually.

\def\adef#1{\catcode#1=13 \bgroup \lccode\~=#1\lowercase{\egroup\def~}}
\let\emphOri=\emph
\def\emphA#1{\emphOri{#1}\egroup}

\emph{text (text) $\bigl( f(x) + y\bigr)$ text}


If you need to redefine \ithsape too, add the lines:

\long\def\addto#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}}

{\itshape text (text) $\bigl( f(x) + y\bigr)$ text}


I mean that this code is more compact and more readable than embrac.sty.

Edit: If you need to give the same behaviour to another braces [square baces, for example], you can try this:

\def\adef#1{\catcode#1=13 \bgroup \lccode\~=#1\lowercase{\egroup\def~}}
\let\emphOri=\emph
\def\emph{\bgroup\activebraces()\activebraces[]\emphA}
\def\emphA#1{\emphOri{#1}\egroup}


But I warn: this will not probably work with automatically generated braces (aka from biblatex) because these braces are already tokenized in the macro. I didn't try it but I assume this behavior. You need to find the braces in the package and replace them by \rm version or use some package option (for setting the type of braces). I don't know, sorry, I am not LaTeX specialist.

• This doesn't work for \itshape since it relies on the usage of \emph. – Werner Jun 7 '14 at 4:05
• @Werner OK, I've added two next lines for \itshape. But this was not required by the question. – wipet Jun 7 '14 at 5:21
• The question states: "second, it does not work for italic texts in theorem environment." I assumed this references some form of \itshape. – Werner Jun 7 '14 at 5:32
• It seems nice! Could you modify your code that handles square brackets as well? I only use square brackets generated by biblatex. – Ma Ming Jun 7 '14 at 15:26
• @MaMing You can try to set \def\bibleftbracket{{\rm[}} \def\bibrightbracket{{\rm]}}. This is a result from my little reverse engineering of biblatex. This is not mentioned in 300 pages manual. And this is without warranty because I didn't try it with real data because I never use such unnecessarily complicated macro packages. – wipet Jun 9 '14 at 6:45

The [] brackets in citations can be fixed using the cite package:

\usepackage{cite}

\def\citeleft{\begingroup\rm[}
\def\citeright{]\endgroup}


This doesn't help with the remaining brackets ()'s in the document. FWIW, I always put mine in math mode.

• hello, could you modify your codes to handle biblatex? It seems that biblatex and cite are incompatible. – Ma Ming Jun 7 '14 at 18:41
• Sorry Ma, I don't have any experience with biblatex. – Andrew Jun 7 '14 at 23:46

Since v0.8 embrac provides \embparen for cases like theorem-like environments. The error from the question with math mode cannot be reproduced…

\documentclass{article}
\usepackage{embrac}[2019-10-01] % v0.8
\newtheorem{theorem}{Theorem}

\begin{document}

\emph{$(x^2)$ not work!}% no error here

\begin{theorem}
Text \embparen{text} text
\end{theorem}

\end{document}