
Ich möchte spezielle mathematische Klammern mit den Symbolen «» (französische Lummen) verwenden. Das Problem besteht jedoch darin, dass sie, wenn ich sie mit \mbox
oder definiere \text
, mit dem umgebenden Text kursiv dargestellt werden.
\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}
Antwort1
Es wird die Schriftart verwendet \text
, die beim Starten der mathematischen Formel gültig war, daher wird sie im kursiven Kontext kursiv dargestellt.
Verwenden Sie \textnormal
stattdessen:
\newcommand{\fopen}{\mathopen{\textnormal{\guillemotleft}}}
\newcommand{\fclose}{\mathclose{\textnormal{\guillemotright}}}
Beachten Sie auch die zusätzlichen Klammern. Nur aufgrund der Implementierung erhalten Sie keine Fehlermeldung. Im folgenden Beispiel füge ich auch eine Möglichkeit hinzu, damit die Befehle dies berücksichtigen \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}
Wenn Sie keinen Mangel an Symbolschriftarten haben, können Sie eine definieren:
\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}