kosmikus / lhs2tex

Preprocessor for typesetting Haskell sources with LaTeX
Other
99 stars 28 forks source link

Document \plainhs, \mathhs, etc. #103

Open sgraf812 opened 5 months ago

sgraf812 commented 5 months ago

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.