Math & Sciencelhs2TeX equation tagging

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
zenzike
Posts: 3
Joined: Thu Jun 11, 2009 7:17 pm

lhs2TeX equation tagging

Post by zenzike »

I'm trying to tag equations produced by lhs2TeX, but I'm completely unable to do so! This is a mixed lhs2TeX / TeX question, so please bear with me if I'm posting on the wrong forum.

The closest I've come to having tagged equations has been:

Code: Select all

\begin{align}
|foo| & |:: Int -> Int| \\
|foo x| & |= x| \tag{foo}
\end{align}
which gives the following TeX when passed through lhs2TeX:

Code: Select all

\begin{align*}
\ensuremath{\Varid{foo}} & \ensuremath{\mathbin{::}\Conid{Int}\to \Conid{Int}} \\
\ensuremath{\Varid{foo}\;\Varid{x}} & \ensuremath{\mathrel{=}\Varid{x}} \tag{foo}
\end{align*}
This really looks horrible, especially when there are several equations! Ideally, I'd like something like:

Code: Select all

\begin{code}
foo    ::  Int -> Int| \\
foo x  =   x   {-" \tag{foo} "-}
\end{code}
The {-" ... "-} section copies the code into the generated TeX from the lhs script.
Obviously doesn't work, since the hscode environment isn't an equation environment. I've tried various things with \mbox and minipage, but nothing seems to work out. Any suggestions?

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply