Questions tagged [lhs2tex]

lhs2TeX is a preprocessor to generate LaTeX code from literate Haskell sources

Filter by
Sorted by
Tagged with
16
votes
2answers
1k views

Fixing mathit spacing with unicode-math

I am using lhs2TeX to convert code into LaTeX. It typesets code into math mode. As I am also writing math formulas in the same document, I use unicode-math to switch between different math mode fonts ...
11
votes
1answer
1k views

Configuring latexmk to use a preprocessor (lhs2TeX)

I want to preprocess an input file before compiling it with, say, pdflatex. I found one way to do this using the "internal" specification described in the latexmk manual, but I expected there to be a ...
6
votes
1answer
265 views

Indentation of a code block in lhs2TeX

What's the (quick and) easy way to set the indentation of a \begin{code}/\end{code} or \begin{spec}/\end{spec}? That is, I want to set only the indentation of the whole block, not the indentation of ...
5
votes
1answer
2k views

Markup Haskell sources in complex structured document with `lhs2TeX`

Simple task Suppose there is a example.tex file with Haskell listings: \documentclass{article} \usepackage{fancyvrb} \DefineVerbatimEnvironment{code}{Verbatim}{fontsize=\small} \begin{document} \...
3
votes
2answers
447 views

Indentation with lhs2TeX

I'm writing a literate Haskell paper, and I'm using lhs2TeX to help make it look pretty. However, lhs2TeX seems to mess up my indentation. I have some source that looks like this: \documentclass[...
3
votes
1answer
119 views

Reproduce lhs2tex’s code indentation in LaTeX

The preprocessor lhs2tex has a very neat way of aligning code. Consider this snippet: let t1 = foo x in let g x = if x > 10 then t1 else let t2 = bar x ...
3
votes
1answer
174 views

Vertical spacing around lhs2TeX code block in floats

How do I get the appropriate vertical space around a \begin{code}/\end{code} or \begin{spec}/\end{spec} in a figure? Here is a basic example with fancyhdr added to show the top of the page: \...
2
votes
1answer
217 views

How to change font in lhs2tex output

Documentation for lhs2tex shows a serif font being used by default as the output from the preprocessor (http://www.andres-loeh.de/lhs2tex/Guide2-1.17.pdf): However, when I run lhs2tex --poly input....
1
vote
2answers
193 views

How to mix lhs2TeX code and spec lines in a single block?

Suppose I have an incomplete code block like: \documentclass{article} %include polycode.fmt \begin{document} \begin{code} somefunction :: a -> a \end{code} \begin{spec} somefunction x = undefined \...
1
vote
2answers
518 views

Changing font size of code in lhs2tex

I am a LaTeX / Haskell newbie and this question involves lhs2tex. Please let me know if I am posting on the wrong forum. I am writing a report in which I have fragments like: \begin{figure} \begin{...
1
vote
1answer
89 views

lhs2TeX and Syntax conflicting on <> characters

I'd like to use Syntax and lhs2TeX together, but Syntax's usage of <> in production rule names seems to conflict with lhs2TeX: \documentclass{article} \usepackage[nounderscore]{syntax} %...
1
vote
1answer
62 views

lhs2tex include file extension

We are using lhs2TeX in a big project. Thus we have many (executable) documents. We have a common .sty file and we also have a common file in which we keep all the often used lhs2TeX directives e.g. %...
1
vote
1answer
287 views

How to beamer \alert code snippets in lhs2TeX?

How to highlight particular ranges of lhs2TeX code in beamer? Naive example (to be preprocessed with lhs2TeX --agda): \documentclass{beamer} %include agda.fmt \begin{document} \begin{frame} \begin{...
1
vote
0answers
319 views

How to change PDF name when piping to pdflatex?

I use MiKTeX on Windows, and lhs2tex to write Haskell programs using Literate Programming. When I run lhs2tex code.lhs | pdflatex on CMD, I get a PDF output called "texput.pdf", but I want it to be ...
1
vote
0answers
149 views

Mixing Agda and Haskell code

I'm preparing a presentation that contains Haskell code on some slides, and Agda on others. However, lhs2TeX dispatches globally on the input language, since it is specified by the command-line switch ...
1
vote
0answers
34 views

Join lhs2TeX code blocks

Consider a document that has multiple print versions. In one version a bit code is hidden (e.g. using %if 0 or the comment package). In the other version there now are adjacent code blocks that really ...
0
votes
1answer
155 views

How do I change the font of code generated by lhs2TeX?

This Guide to lhs2TeX shows an example of customization of the poly style in 4.2 which is pretty much exactly what I want, but it does not actually show the way to achieve this. I am quite new LaTeX ...
0
votes
0answers
26 views

How to use \perform of lhs2tex in a \newcommand

I was trying to define a command \runx, which not only evaluates a Haskell expression (this is what \perform already does), but also prints the expression before the evaluation. So I tried \...
0
votes
0answers
65 views

Call lhs2tex from LateX

The lhs2tex tool is a very awesome code formatter, especially for Haskell, but it usually expects to be run as a preprocessor. Now I really like being able to just pdflatex my files, especially when I ...