lhs2tex icon indicating copy to clipboard operation
lhs2tex copied to clipboard

Document \plainhs, \mathhs, etc.

Open sgraf812 opened this issue 10 months ago • 0 comments

I just discovered that can use \begin{code}...\end{code} blocks in display math and even arrays, to format code blocks side-by-side:

\[
\mathhs
\begin{array}{ccc}
\begin{code}
not :: Bool -> Bool
not b  | False <- b  = True
       | True <- b   = False
\end{code} &
\begin{code}
not2 :: Bool -> Bool
not2 False  = True
not2 True   = False
\end{code} &
\begin{code}
not3 :: Bool -> Bool
not3 x | False <- x  = True
not3 True            = False
\end{code}
\end{array}
\plainhs
\]

Alas, I had to carefully read polycode.fmt for that. I haven't found anything in the user's guide or on the TeX SE.

Let this issue serve as documentation until either the user's guide or TeX SE picks it up.

sgraf812 avatar Apr 04 '24 08:04 sgraf812