How to hide a code block

I write the program in a .lhs file that contains the code in Haskell (I specify this because I want to make it clear that this is not only for rendering pdf, but also for running with runhaskell or ghci). I pass the code with lstlisting as follows:

\begin{lstlisting} > Haskell code here \end{lstlisting} 

In any case, the code itself requires some modules that I need to import, but I do not want the import to appear in the resulting pdf. So, I tried to put the code without the lstlisting block, for example:

 > import X > import Y ... 

But it does not work, and the resulting PDF file makes these lines only different from the lstlisting code. What should I do to write import code only for execution, but not displayed in the PDF file itself?

+4
source share
1 answer

The Haskell wiki suggests defining a LaTeX macro, for example:

 \long\def\ignore#1{} 

You can also define this with \newcommand , which seems more natural to me:

 \newcommand{\ignore}[1]{} 

In both cases, it is used as follows:

 \ignore{ > import Foo.Bar (baz) } 

`

+4
source

Source: https://habr.com/ru/post/1480013/


All Articles