我已定义 \imag 命令来使用字体 \texttt 分配虚数单位的值。但是,当我在具有普通样式的定理环境中调用命令 \imag 时,字体会以斜体字体打印。有谁知道解决这个问题的通用方法吗?
以下是一个最小可编译示例
\documentclass[a4paper, 11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
% ----------------------------
% STANDARD PACKAGES FOR MATH
% ----------------------------
\usepackage{amsmath} % AMS Math Package
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm} % theorem formatting
\usepackage{bm} % bold math
\usepackage{physics}
% Note: "dsfont" override \mathbb{} blackboard bold font provided by "amsfonts"
\theoremstyle{plain} % default
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newcommand{\imag}{\texttt{i}} % imaginary number
\begin{document}
\begin{theorem}[Duffy, Pan and Singleton (2000)]
If $\vb{X}(t)$ is in the affine form, the discounted characteristic function defined as
\begin{equation}
\phi(\vb{u},\vb{X}(t),t,T) = \mathbb{E}^{\mathbb{Q}}\left[
e^{-\int_{t}^{T} r(\vb{X}(s))\dd{s} + \imag \vb{u}^{T} \vb{X}(T)} \left|\right. \mathcal{F}_{t}
\right] ~ \forall \, \vb{u} \in \mathbb{C}^{d},
\end{equation}
with boundary condition
\begin{equation}
\phi(\vb{u},\vb{X}(T),T,T) = e^{\imag \vb{u}^{T} \vb{X}(T)},
\end{equation}
has a solution of the following form
\begin{equation}\label{eq:AD_chf}
\phi(\vb{u},\vb{X}(T),t,T) = e^{A(\vb{u},t,T) + \vb{B}(\vb{u},t,T)^{T} \vb{X}(t)}
\end{equation}
\end{theorem}
\end{document}
答案1
你要
\newcommand{\imag}{\mathtt{i}}
(假设你真的想要这样一种非标准符号)。
如果你缺少数学组(运行文档后你将收到通知),你可以声明\normalfont\ttfamily
\newcommand{\imag}{\text{\normalfont\ttfamily i}}
只是为了遵守我个人的“physics
做很多有争议的事情”并建议更好的排版:
\documentclass[a4paper, 11pt]{article}
\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
% ----------------------------
% STANDARD PACKAGES FOR MATH
% ----------------------------
\usepackage{amsmath} % AMS Math Package
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm} % theorem formatting
\usepackage{bm} % bold math
%\usepackage{physics}
\theoremstyle{plain} % default
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newcommand{\imag}{\mathtt{i}} % imaginary number
\newcommand{\vb}[1]{\mathbf{#1}}% might also be \bm{#1}
\newcommand{\bC}{\mathbb{C}}
\newcommand{\bE}{\mathbb{E}}
\newcommand{\bQ}{\mathbb{Q}}
\newcommand{\diff}{\mathop{}\!\mathrm{d}}
\begin{document}
\begin{theorem}[Duffy, Pan and Singleton (2000)]
If $\vb{X}(t)$ is in the affine form, the discounted characteristic function defined as
\begin{equation}
\phi(\vb{u},\vb{X}(t),t,T) = \bE^{\bQ}
% \left[
\bigl[
e^{-\int_{t}^{T} r(\vb{X}(s))\diff s + \imag \vb{u}^{T} \vb{X}(T)}
% \;\middle|\;
\bigm|
\mathcal{F}_{t}
% \right]
\bigr]
\quad \forall \, \vb{u} \in \bC^{d},
\end{equation}
with boundary condition
\begin{equation}
\phi(\vb{u},\vb{X}(T),T,T) = e^{\imag \vb{u}^{T} \vb{X}(T)},
\end{equation}
has a solution of the following form
\begin{equation}\label{eq:AD_chf}
\phi(\vb{u},\vb{X}(T),t,T) = e^{A(\vb{u},t,T) + \vb{B}(\vb{u},t,T)^{T} \vb{X}(t)}
\end{equation}
\end{theorem}
\end{document}
我保留(评论)了这些\left\middle\right
命令(无论如何,比你的尝试要好),以表明\big
尺寸确实足够。
我注释掉physics
并定义了\vb
相同的操作。实际上physics
提供了\vb*{x}
使用粗体斜体。如果打算同时使用这两种类型,它们应该是两个不同的命令。
physics
定义方式也\dd
很奇怪。我不认为输入起来更困难
\diff^{3} x \diff(\cos x)
代替
\dd[3]{x} \dd(\cos x)