Top*_*her 7 latex renewcommand
我是一个乳头新手,但我一直在做功课,现在我有一个问题似乎无法找到答案.我创建了一个方程的定义,让我们说它是这个:
The potential is characterized by a length $\sigma$ and an energy $\epsilon$.
Run Code Online (Sandbox Code Playgroud)
实际上,这个等式更复杂,这就是我想尝试捷径的原因.如果我的等式是这种简单化,我不会尝试我的替代技术.我使用\ renewcommand节省了一些时间:
\renewcommand{\sigma}{1}
Run Code Online (Sandbox Code Playgroud)
这非常有效,并将用1替换所有sigma实例.不幸的是,由于\ sigma具有全局范围,我需要重置它.我尝试了几种不同的方法:
尝试1:由于循环引用而导致-deadlock?
\newcommand{\holdsigma}{\sigma}
\renewcommand{\sigma}{1}
The potential is characterized by a length $\sigma$ and an energy $\epsilon$.
\renewcommand{\sigma}{\holdsigma}
Run Code Online (Sandbox Code Playgroud)
我想重置命令,看起来应该是这样的:
\renewcommand{\sigma}{\greek{\sigma}}
Run Code Online (Sandbox Code Playgroud)
但这显然对我没有用.
关于希腊字母最初是如何在语言中定义的任何想法?
god*_*byk 11
我不得不承认,我不明白你为什么要做你所要求的,但这应该有效:
\documentclass{article}
\begin{document}
Before redefinition, \verb|\sigma| looks like $\sigma$.
% Copy the current definition of \sigma to \oldsigma
\let\oldsigma\sigma
% Redefine \sigma to be '1'
\renewcommand{\sigma}{1}
After redefinition, \verb|\sigma| looks like $\sigma$.
You can still use \verb|\oldsigma| if you want to use the original definition $\oldsigma$.
% Restore the original definition of \sigma
\let\sigma\oldsigma
Now \verb|\sigma| is back to its normal appearance $\sigma$.
\end{document}
Run Code Online (Sandbox Code Playgroud)
要了解\\sigma最初定义的方式或任何其他命令,您可以使用\\show\\sigma. (答案是\\sigma定义为\\mathchar"11B。)您可以在文档本身中键入此内容 \xe2\x80\x94\xc2\xa0 编译将暂停,您可以在阅读回复后键入 Enter \xe2\x80\x94\xc2\xa0 或你可以在 TeX/LaTeX 的交互模式下输入它。
文档示例:
\n\n\\documentclass{article}\n\\begin{document}\nWhat is $\\sigma$? % Prints "What is \xcf\x83" in the DVI/PS/PDF.\n\\show\\sigma % Prints "> \\sigma=\\mathchar"11B." in the compilation.\nNow that we know, let us redefine it.\n\\renewcommand{\\sigma}{1}\nNow it is: $\\sigma$. % Prints "Now it is: 1." in the DVI/PS/PDF.\nOK, let\'s go back.\n\\renewcommand{\\sigma}{\\mathchar"11B}\nWe again have: $\\sigma$. %Prints "We again have: \xcf\x83." in the DVI/PS/PDF.\n\\end{document}\nRun Code Online (Sandbox Code Playgroud)\n\n或者在命令提示符处,键入latex,然后键入\\relax,然后键入\\show\\sigma,阅读其内容,然后键入x退出。
| 归档时间: |
|
| 查看次数: |
6257 次 |
| 最近记录: |