
Quero usar colchetes matemáticos especiais com os símbolos «» (guillemots franceses). Mas o problema é que quando eu os defino usando \mbox
ou \text
, eles ficam em itálico com o texto ao redor.
\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}
Responder1
A fonte utilizada \text
é aquela que estava em vigor quando a fórmula matemática foi iniciada, portanto será itálico no contexto itálico.
Use \textnormal
, em vez disso:
\newcommand{\fopen}{\mathopen{\textnormal{\guillemotleft}}}
\newcommand{\fclose}{\mathclose{\textnormal{\guillemotright}}}
Observe também os colchetes adicionais; é apenas por causa da implementação que você não recebe uma mensagem de erro. No exemplo abaixo também adiciono uma forma de fazer com que os comandos respeitem \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}
Se você não tiver falta de fontes de símbolos, poderá definir uma:
\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}