2011-05-01 48 views
6

我是LaTeX的新手,但我一直在做我的功课,现在我有一个问题,我似乎无法找到答案。 我创建一个公式的定义,让我们只说这是这一个:如何使用 renew命令获取我的希腊字母?

The potential is characterized by a length $\sigma$ and an energy $\epsilon$. 

在现实中,这个公式比较复杂,这就是为什么我想尝试的一条捷径。如果我的方程是简单的,我不会尝试我的替代技术。 我使用\ renewcommand给我节省时间:

\renewcommand{\sigma}{1} 

而这个惊人的作品,将与1替代西格玛的所有实例但不幸的是,因为\西格玛拥有全球范围内,我需要重置。 我尝试了几种不同的方式:
尝试1: - 由于循环引用而导致死锁?

\newcommand{\holdsigma}{\sigma} 
\renewcommand{\sigma}{1} 
The potential is characterized by a length $\sigma$ and an energy $\epsilon$. 
\renewcommand{\sigma}{\holdsigma} 

我想重置命令,就应该是这个样子:

\renewcommand{\sigma}{\greek{\sigma}} 

但显然没有为我解决。

关于希腊字母最初是如何在语言中定义的任何想法?

+1

不要忘记http://tex.stackexchange.com/ – Gabe 2011-05-01 02:09:22

+1

这似乎是一个非常糟糕的主意。无论何时您需要使用它,您都必须来回翻转\ sigma的定义。您不能编辑公式并使用'\ mysigma'或其他东西? – drysdam 2011-05-01 02:18:50

+0

我想到了这一点,这可能是我最终会做的,但为了将来的参考,我想知道是否有可能来回翻转。 – TopherGopher 2011-05-01 02:33:52

回答

3

要了解如何最初定义\sigma或任何其他命令,可以使用\show\sigma。 (答案是\sigma被定义为\mathchar"11B。)您可以在文档本身中键入此选项 - 编辑将会暂停,您可以在阅读答复后键入Enter,或者您可以在TeX/LaTeX的交互模式下输入。

实例与文档:

\documentclass{article} 
\begin{document} 
What is $\sigma$?   % Prints "What is σ" in the DVI/PS/PDF. 
\show\sigma    % Prints "> \sigma=\mathchar"11B." in the compilation. 
Now that we know, let us redefine it. 
\renewcommand{\sigma}{1} 
Now it is: $\sigma$.  % Prints "Now it is: 1." in the DVI/PS/PDF. 
OK, let's go back. 
\renewcommand{\sigma}{\mathchar"11B} 
We again have: $\sigma$. %Prints "We again have: σ." in the DVI/PS/PDF. 
\end{document} 

否则在命令提示符下,键入latex,然后键入\relax,然后键入\show\sigma,念出来,然后键入x退出。

10

我不得不承认,我不明白为什么你想要做你问什么,但是这应该工作:

\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}