6

I want to use special math brackets with the symbols «» (french guillemots). But the problem is that when I define them using \mbox or \text, they become italicized with the surrounding text.

\documentclass[12pt,a4paper]{letter}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\begin{document}
\newcommand{\fopen}{\mathopen\text{\guillemotleft}}
\newcommand{\fclose}{\mathclose\text{\guillemotright}}
\newcommand{\ff}[1]{\fopen #1\fclose}   

\textbf{What I have}

With normal text $\ff{O:P:Q}$ 

{\itshape With text in italic $\ff{O:P:Q}$ } (guillemots in italic)

\textbf{What it should be}

With normal text $\ff{O:P:Q}$ 

{\itshape With text in italic}  $\ff{O:P:Q}$ 
\end{document}

math_guillemots_italic

  • 2
    You could replace \text with \textup – GuM Jun 30 '17 at 23:40
  • 3
    It should be \mathopen{\textnormal{<<}} (or \guillemotleft instead of <<). – egreg Jun 30 '17 at 23:42
  • 1
    …but maybe what you are truly after are \llangle and \rrangle from the MnSymbol package. – GuM Jun 30 '17 at 23:52
  • Both \textup and \textnormal solve the problem. @GustavoMezzetti I'm already using \llangle and \rrangle for other things. – sf rajaona Jul 1 '17 at 0:26
  • @egreg is right, \textnormal is (obviously) better, since it will reset all font characteristics, and not just the shape, to their “normal” setting. Of course, with either definition the delimiters you get cannot be used as variable-sized delimiters; but, if you load the amsmath package (actually, the amstext package would suffice), they will scale down correctly when used in (first or higher order) sub-/superscript. – GuM Jul 1 '17 at 0:36
6

The font used for \text is the one which was in force when the math formula was started, so it will be italic in italic context.

Use \textnormal, instead:

\newcommand{\fopen}{\mathopen{\textnormal{\guillemotleft}}}
\newcommand{\fclose}{\mathclose{\textnormal{\guillemotright}}}

Note also the additional braces; it's only because of the implementation that you don't get an error message. In the example below I also add a way to make the commands respect \boldmath.

\documentclass[12pt,a4paper]{letter}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{pdftexcmds}

\makeatletter
\newcommand{\normalorbold}{%
  \ifnum\pdf@strcmp{\math@version}{bold}=\z@\bfseries\fi
}
\makeatother

\newcommand{\fopen}{\mathopen{\textnormal{\normalorbold\guillemotleft}}}
\newcommand{\fclose}{\mathclose{\textnormal{\normalorbold\guillemotright}}}
\newcommand{\ff}[1]{\fopen #1\fclose}   

\begin{document}

\textbf{What I have}

With normal text $\ff{O:P:Q}$ 

{\itshape With text in italic $\ff{O:P:Q}$}

\textbf{What it should be}

With normal text $\ff{O:P:Q}$ 

{\itshape With text in italic}  $\ff{O:P:Q}$ 

{\boldmath $\ff{O:P:Q}$}

\end{document}

enter image description here

If you're not short of symbol fonts, you can define one:

\documentclass[12pt,a4paper]{letter}
\usepackage[T1]{fontenc}
\usepackage{amsmath}

\DeclareSymbolFont{supplsymbols}{T1}{\familydefault}{m}{n}
\SetSymbolFont{supplsymbols}{bold}{T1}{\familydefault}{bx}{n}

\DeclareMathSymbol{\fopen}{\mathopen}{supplsymbols}{19}
\DeclareMathSymbol{\fclose}{\mathclose}{supplsymbols}{20}
\newcommand{\ff}[1]{\fopen #1\fclose}   

\begin{document}

\textbf{What I have}

With normal text $\ff{O:P:Q}$ 

{\itshape With text in italic $\ff{O:P:Q}$}

\textbf{What it should be}

With normal text $\ff{O:P:Q}$ 

{\itshape With text in italic}  $\ff{O:P:Q}$ 

{\boldmath $\ff{O:P:Q}$}

\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.