Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use \renewcommand to get BACK my greek letters?

I'm a LaTeX newbie, but I've been doing my homework, and now I have a question that I can't seem to find the answer to. I create the definition of an equation, let's just say it's this one:

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

In reality, this equation is more complex, which is why I wanted to try a shortcut. If my equation were this simplistic, I wouldn't try my substitution technique. I use the \renewcommand to save me some time:

\renewcommand{\sigma}{1}

And this works fabulously and will replace all instances of sigma with 1. Unfortunately though, since \sigma has a global scope, I need to reset it. I tried a couple different ways:
Attempt 1: -deadlock due to circular reference?

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

I would think to reset the command, it should look something like this:

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

but that obviously hasn't worked out for me.

Any idea about how the greek letters are originally defined in the language?

like image 845
TopherGopher Avatar asked May 01 '11 01:05

TopherGopher


1 Answers

I have to admit that I don't understand why you want to do what you're asking, but this should work:

\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}
like image 142
godbyk Avatar answered Oct 03 '22 15:10

godbyk