help-gnu-emacs
[Top][All Lists]

## Re: Hiding references when editing LaTeX?

 From: David Kastrup Subject: Re: Hiding references when editing LaTeX? Date: 26 Feb 2003 20:39:17 +0100 User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

"Felix E. Klee" <felix.klee@inka.de> writes:

> I like to use long names for labels in my LaTeX code.

Why?  Are you using RefTeX?  It comes bundled with Emacs, creates
labels automatically and makes handling them a breeze.  For example,
in connection with AUCTeX it automatically assigns labels like
\label{eq:21} which sounds like a pretty bad idea until you realize
that C-c ) will give you a list of all relevant equations to scroll
through and hit the right one.  So no need to memorize any labels.

> However, I find the
> corresponding long reference commands disturbing when reading the code. Is
> it possible to hide these references?

> An example:
>     We use equation \ref{SomeVeryVeryLongReference} to show something.
>   I want to see
>     We use equation # to show something.
>   but upon moving the cursor on top of the '#' I want to see
>     We use equation \ref{SomeVeryVeryLongReference} to show something.
>   again.

preview-latex <URL:http://preview-latex.sourceforge.net> would do
exactly that if you created a file prauctex.cfg with the contents

\PreviewCommand[!][\#]\ref
\InputIfFileExists{preview/prauctex.cfg}{}{}

in your project directory.  You could also try
\PreviewCommand[!]\ref
to have the dereferenced label itself displayed as typeset by LaTeX,
or
\RequirePackage{url}
\PreviewCommand[!][\@firstoftwo\url#1]\ref
to have the original label text in typewriter mode and so on.

Also handy for collapsing footnotes into their respective footnote
mark.  In short, preview-latex allows you to tell LaTeX how you want
certain constructs display in your Emacs window, obviously defaulting
to their normal typeset rendition.

But for labels, I'd really recommend going with RefTeX instead.  Try
it.  Manual should be available with
C-h i d m reftex RET

--
David Kastrup, Kriemhildstr. 15, 44793 Bochum