我有以下代码
\documentclass{article}
\usepackage{amsmath}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}~\\
Text and something else: $j \in \{1, \ldots, J\}$
\end{theorem}~\\
Text and something else: $j \in \{1, \ldots, J\}$
Text and something else: $\rm j \in \{1, \ldots, J\}$
\end{document}
我希望,总是将1
输入为J
(前两次以斜体显示,最后一次以直立字体显示)。有没有一种自动化的方法 - 比如宏 \one - 可以做到这一点?
编辑:
因为我发现这不是我想要的,所以我发布了一个新问题: 将数字排版为数学和数字
答案1
你可以,但数学中的数字都是直立排版的,这是一个悠久的传统。
\documentclass{article}
\usepackage{amsmath,amsthm,thmtools}
\declaretheoremstyle[
spaceabove=\topsep,
spacebelow=\topsep,
bodyfont=\itshape,
break,
]{break}
\declaretheorem[
style=break,
name=Theorem,
]{theorem}
\DeclareSymbolFont{italic}{OT1}{\familydefault}{m}{it}
\SetSymbolFont{italic}{bold}{OT1}{\familydefault}{bx}{it}
\DeclareSymbolFontAlphabet{\mathit}{italic}
\DeclareMathSymbol{0}{\mathalpha}{italic}{`0}
\DeclareMathSymbol{1}{\mathalpha}{italic}{`1}
\DeclareMathSymbol{2}{\mathalpha}{italic}{`2}
\DeclareMathSymbol{3}{\mathalpha}{italic}{`3}
\DeclareMathSymbol{4}{\mathalpha}{italic}{`4}
\DeclareMathSymbol{5}{\mathalpha}{italic}{`5}
\DeclareMathSymbol{6}{\mathalpha}{italic}{`6}
\DeclareMathSymbol{7}{\mathalpha}{italic}{`7}
\DeclareMathSymbol{8}{\mathalpha}{italic}{`8}
\DeclareMathSymbol{9}{\mathalpha}{italic}{`9}
\DeclareMathSymbol{!}{\mathclose}{italic}{"21}
\begin{document}
\begin{theorem}
Text and something else: $j \in \{1, \ldots, J\}$
\end{theorem}
Text and something else: $j \in \{1, \ldots, J\}$
Text and something else: $j \in \{\mathrm{1, \ldots, J}\}$
\end{document}