Quiero usar corchetes matemáticos especiales con los símbolos «» (araos franceses). Pero el problema es que cuando los defino usando \mbox
o \text
, se ponen en cursiva con el texto circundante.
\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}
Respuesta1
La fuente utilizada \text
es la que estaba vigente cuando se inició la fórmula matemática, por lo que estará en cursiva en el contexto de cursiva.
Utilice \textnormal
en su lugar:
\newcommand{\fopen}{\mathopen{\textnormal{\guillemotleft}}}
\newcommand{\fclose}{\mathclose{\textnormal{\guillemotright}}}
Tenga en cuenta también las llaves adicionales; es sólo debido a la implementación que no recibe un mensaje de error. En el siguiente ejemplo también agrego una forma de hacer que los comandos respeten \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}
Si no te faltan fuentes de símbolos, puedes definir una:
\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}