我正在尝试找到一种方法将名称作为变量包含在我的方程中
\documentclass{article}
\usepackage[margin=2.5cm,a4paper]{geometry}
\usepackage{amsmath}
\newcommand{\Risk}{\mathop{\textnormal{\slshape Risk}}\nolimits}
\newcommand{\CEOGOV}{\mathop{\textnormal{\slshape CEO\_GOV}}\nolimits}
\newcommand{\CEOPR}{\mathop{\textnormal{\slshape CEO\_PR}}\nolimits}
\newcommand{\OwnershipConC}{\mathop{\textnormal{\slshape Ownership\_ConC}}\nolimits}
\newcommand{\Controls}{\mathop{\textnormal{\slshape Controls}}\nolimits}
\begin{document}
\begin{equation}
\begin{split}
\Risk_{i,t} = &\alpha + \beta_{1}\CEOPR_{i,t} +\beta_{2}\CEOGOV_{i,t}
+\sigma_{1}\OwnershipConC_{i,t}+\sigma_{2}\left(\OwnershipConC_{i,t}*\CEOGOV_{i,t}\right)
\\
&+\sigma_{3}\left(\OwnershipConC_{i,t}*\CEOPR_{i,t}\right)+\sigma_{4}\Controls_{i,t}
\end{split}
\end{equation}
\end{document}
答案1
目前尚不清楚您在问什么,但显然它是关于您的帖子顶部的双下标输出。
如果您定义一个命令\variablename
并以此表达所有变量,您的示例将变得更容易编写和修改。您可以使用 a\variablename
作为另一个 的下标\variablename
,但您需要将其括在括号中。
\documentclass{article}
\usepackage[paperwidth=10cm]{geometry}
\usepackage{amsmath}
\usepackage{iftex}
\iftutex
\usepackage{fontspec}
\else
\usepackage[T1]{fontenc}
\fi
\pagestyle{empty}
\DeclareRobustCommand{\variablename}[1]{\mathop{\textnormal{\slshape #1}}\nolimits}
\newcommand{\Risk}{\variablename{Risk}}
\newcommand{\CEOGOV}{\variablename{CEO\_GOV}}
\newcommand{\CEOPR}{\variablename{CEO\_PR}}
\newcommand{\OwnershipConC}{\variablename{Ownership\_ConC}}
\newcommand{\Controls}{\variablename{Controls}}
\newcommand{\CEOPOCGOVOFF}{\variablename{CEO}_{\variablename{POC}_{\variablename{GOVOFF}}}}
\begin{document}
\begin{equation}
\begin{split}
\Risk_{i,t} = &\alpha + \beta_{1}\CEOPR_{i,t} + \beta_{2}\CEOGOV_{i,t} + \\
&\sigma_{1}\OwnershipConC_{i,t} + \\
&\sigma_{2}\left(\OwnershipConC_{i,t} \times \CEOGOV_{i,t}\right) + \\
&\sigma_{3}\left(\OwnershipConC_{i,t} \times \CEOPR_{i,t}\right) + \\
&\sigma_{4}\Controls_{i,t}
\end{split}
\end{equation}
\[ \CEOPOCGOVOFF \]
\end{document}
如果您确实想要在变量名中使用撇号,则此定义\variablename
可让您以在文本模式下输入它。