Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module is the Prelude of LaTeX functions. It includes commands, environments, and some other useful abstractions, that don't require you to import additional LaTeX packages.
Synopsis
- raw :: LaTeXC l => Text -> l
- between :: Monoid m => m -> m -> m -> m
- comment :: LaTeXC l => Text -> l
- (%:) :: LaTeXC l => l -> Text -> l
- title :: LaTeXC l => l -> l
- author :: LaTeXC l => l -> l
- date :: LaTeXC l => l -> l
- institute :: LaTeXC l => Maybe l -> l -> l
- thanks :: LaTeXC l => l -> l
- documentclass :: LaTeXC l => [ClassOption] -> ClassName -> l
- usepackage :: LaTeXC l => [l] -> PackageName -> l
- linespread :: LaTeXC l => Float -> l
- article :: ClassName
- proc :: ClassName
- report :: ClassName
- minimal :: ClassName
- book :: ClassName
- slides :: ClassName
- data ClassOption
- customopt :: String -> ClassOption
- draft :: ClassOption
- titlepage :: ClassOption
- notitlepage :: ClassOption
- onecolumn :: ClassOption
- twocolumn :: ClassOption
- oneside :: ClassOption
- twoside :: ClassOption
- landscape :: ClassOption
- openright :: ClassOption
- openany :: ClassOption
- fleqn :: ClassOption
- leqno :: ClassOption
- data PaperType
- a0paper :: ClassOption
- a1paper :: ClassOption
- a2paper :: ClassOption
- a3paper :: ClassOption
- a4paper :: ClassOption
- a5paper :: ClassOption
- a6paper :: ClassOption
- b0paper :: ClassOption
- b1paper :: ClassOption
- b2paper :: ClassOption
- b3paper :: ClassOption
- b4paper :: ClassOption
- b5paper :: ClassOption
- b6paper :: ClassOption
- letterpaper :: ClassOption
- executivepaper :: ClassOption
- legalpaper :: ClassOption
- pagestyle :: LaTeXC l => PageStyle -> l
- thispagestyle :: LaTeXC l => PageStyle -> l
- plain :: PageStyle
- headings :: PageStyle
- empty :: PageStyle
- myheadings :: PageStyle
- markboth :: LaTeXC l => l -> l -> l
- markright :: LaTeXC l => l -> l
- document :: LaTeXC l => l -> l
- maketitle :: LaTeXC l => l
- tableofcontents :: LaTeXC l => l
- abstract :: LaTeXC l => l -> l
- appendix :: LaTeXC l => l
- part :: LaTeXC l => l -> l
- chapter :: LaTeXC l => l -> l
- section :: LaTeXC l => l -> l
- section' :: LaTeXC l => l -> l
- subsection :: LaTeXC l => l -> l
- subsection' :: LaTeXC l => l -> l
- subsubsection :: LaTeXC l => l -> l
- subsubsection' :: LaTeXC l => l -> l
- paragraph :: LaTeXC l => l -> l
- subparagraph :: LaTeXC l => l -> l
- today :: LaTeXC l => l
- thePage :: LaTeXC l => l
- tex :: LaTeXC l => l
- latex :: LaTeXC l => l
- laTeX2 :: LaTeXC l => l
- laTeXe :: LaTeXC l => l
- ldots :: LaTeXC l => l
- vdots :: LaTeXC l => l
- ddots :: LaTeXC l => l
- hatex :: LaTeXC l => l
- hatex3 :: LaTeXC l => l
- version :: Version
- hatex_version :: LaTeXC l => l
- par :: LaTeXC l => l
- newline :: LaTeXC l => l
- lnbk :: LaTeXC l => l
- lnbk_ :: LaTeXC l => l
- lnbkspc :: LaTeXC l => Measure -> l
- lnbkspc_ :: LaTeXC l => Measure -> l
- newpage :: LaTeXC l => l
- cleardoublepage :: LaTeXC l => l
- clearpage :: LaTeXC l => l
- linebreak :: LaTeXC l => l -> l
- nolinebreak :: LaTeXC l => l -> l
- pagebreak :: LaTeXC l => Maybe l -> l
- nopagebreak :: LaTeXC l => Maybe l -> l
- hspace :: LaTeXC l => Measure -> l
- hspace_ :: LaTeXC l => Measure -> l
- vspace :: LaTeXC l => Measure -> l
- vspace_ :: LaTeXC l => Measure -> l
- addvspace :: LaTeXC l => Measure -> l
- quad :: LaTeXC l => l
- qquad :: LaTeXC l => l
- hfill :: LaTeXC l => l
- vfill :: LaTeXC l => l
- dotfill :: LaTeXC l => l
- hrulefill :: LaTeXC l => l
- stretch :: LaTeXC l => Double -> l
- smallskip :: LaTeXC l => l
- medskip :: LaTeXC l => l
- bigskip :: LaTeXC l => l
- baselineskip :: LaTeXC l => l
- indent :: LaTeXC l => l
- noindent :: LaTeXC l => l
- textwidth :: LaTeXC l => l
- textheight :: LaTeXC l => l
- linewidth :: LaTeXC l => l
- verbatim :: LaTeXC l => Text -> l
- verb :: LaTeXC l => Text -> l
- textbf :: LaTeXC l => l -> l
- textit :: LaTeXC l => l -> l
- texttt :: LaTeXC l => l -> l
- textrm :: LaTeXC l => l -> l
- textsf :: LaTeXC l => l -> l
- textmd :: LaTeXC l => l -> l
- textup :: LaTeXC l => l -> l
- textsl :: LaTeXC l => l -> l
- textsc :: LaTeXC l => l -> l
- textnormal :: LaTeXC l => l -> l
- underline :: LaTeXC l => l -> l
- emph :: LaTeXC l => l -> l
- tiny :: LaTeXC l => l -> l
- scriptsize :: LaTeXC l => l -> l
- footnotesize :: LaTeXC l => l -> l
- small :: LaTeXC l => l -> l
- normalsize :: LaTeXC l => l -> l
- large :: LaTeXC l => l -> l
- large2 :: LaTeXC l => l -> l
- large3 :: LaTeXC l => l -> l
- huge :: LaTeXC l => l -> l
- huge2 :: LaTeXC l => l -> l
- enumerate :: LaTeXC l => l -> l
- itemize :: LaTeXC l => l -> l
- item :: LaTeXC l => Maybe l -> l
- flushleft :: LaTeXC l => l -> l
- flushright :: LaTeXC l => l -> l
- center :: LaTeXC l => l -> l
- quote :: LaTeXC l => l -> l
- verse :: LaTeXC l => l -> l
- cite :: LaTeXC l => l -> l
- description :: LaTeXC l => l -> l
- minipage :: LaTeXC l => Maybe Pos -> l -> l -> l
- figure :: LaTeXC l => Maybe Pos -> l -> l
- table :: LaTeXC l => [Pos] -> l -> l
- pagenumbering :: LaTeXC l => l -> l
- arabic :: LaTeXC l => l
- roman :: LaTeXC l => l
- roman_ :: LaTeXC l => l
- alph :: LaTeXC l => l
- alph_ :: LaTeXC l => l
- mbox :: LaTeXC l => l -> l
- fbox :: LaTeXC l => l -> l
- parbox :: LaTeXC l => Maybe Pos -> Measure -> l -> l
- framebox :: LaTeXC l => Maybe Measure -> Maybe HPos -> l -> l
- makebox :: LaTeXC l => Maybe Measure -> Maybe HPos -> l -> l
- raisebox :: LaTeXC l => Measure -> Maybe Measure -> Maybe Measure -> l -> l
- rule :: LaTeXC l => Maybe Measure -> Measure -> Measure -> l
- caption :: LaTeXC l => l -> l
- label :: LaTeXC l => l -> l
- ref :: LaTeXC l => l -> l
- pageref :: LaTeXC l => l -> l
- tabular :: LaTeXC l => Maybe Pos -> [TableSpec] -> l -> l
- tabularnewline :: LaTeXC l => l
- tabularnewlineSpc :: LaTeXC l => Measure -> l
- arraybackslash :: LaTeXC l => l
- array :: LaTeXC l => Maybe Pos -> [TableSpec] -> l -> l
- (&) :: LaTeXC l => l -> l -> l
- hline :: LaTeXC l => l
- cline :: LaTeXC l => Int -> Int -> l
- multicolumn :: LaTeXC l => Int -> [TableSpec] -> l -> l
- matrixTabular :: (LaTeXC l, Texy a) => [l] -> Matrix a -> l
- centering :: LaTeXC l => l
- raggedleft :: LaTeXC l => l
- raggedright :: LaTeXC l => l
- footnote :: LaTeXC l => l -> l
- footnotemark :: LaTeXC l => l
- footnotetext :: LaTeXC l => l -> l
- stepcounter :: LaTeXC l => String -> l
- addtocounter :: LaTeXC l => String -> Int -> l
- protect :: LaTeXC l => l -> l
- hyphenation :: LaTeXC l => l -> l
- hyp :: LaTeXC l => l
- qts :: LaTeXC l => l -> l
- module Text.LaTeX.Base.Math
- input :: LaTeXC l => FilePath -> l
- include :: LaTeXC l => FilePath -> l
Basic functions
raw :: LaTeXC l => Text -> l Source #
Insert a raw piece of Text
.
This functions doesn't escape LaTeX
reserved characters,
it insert the text just as it is received.
Warning: This function is unsafe, in the sense that it does not check that the input text is a valid LaTeX block. Make sure any braces, commands or environments are properly closed.
between :: Monoid m => m -> m -> m -> m Source #
Calling between
c l1 l2
puts c
between l1
and l2
and
appends them.
between c l1 l2 = l1 <> c <> l2
(%:) :: LaTeXC l => l -> Text -> l Source #
This operator appends a comment after a expression. For example:
textbf "I'm just an example." %: "Insert a few words here."
The implementation is
(%:) l = (l <>) . comment
Since you are writing in Haskell, you may not need to output comments as you can add them in the Haskell source. I added this feature for completeness. It may be useful for debugging the output as well.
Preamble commands
institute :: LaTeXC l => Maybe l -> l -> l Source #
Set either an institute or an organization
for the document. It does not work for
a document of the article
class.
:: LaTeXC l | |
=> [ClassOption] | Class options |
-> ClassName | Class name |
-> l |
Set the document class. Needed in all documents.
usepackage :: LaTeXC l => [l] -> PackageName -> l Source #
Import a package. First argument is a list of options for the package named in the second argument.
linespread :: LaTeXC l => Float -> l Source #
Classes
Document classes
Class options
data ClassOption Source #
A class option to be passed to the documentclass
function.
Draft | |
TitlePage | |
NoTitlePage | |
OneColumn | |
TwoColumn | |
OneSide | |
TwoSide | |
Landscape | |
OpenRight | |
OpenAny | |
Fleqn | |
Leqno | |
FontSize Measure | |
Paper PaperType | |
CustomOption String |
Instances
Show ClassOption Source # | |
Defined in Text.LaTeX.Base.Commands showsPrec :: Int -> ClassOption -> ShowS # show :: ClassOption -> String # showList :: [ClassOption] -> ShowS # | |
IsString ClassOption Source # | |
Defined in Text.LaTeX.Base.Commands fromString :: String -> ClassOption # | |
Render ClassOption Source # | |
Defined in Text.LaTeX.Base.Commands render :: ClassOption -> Text Source # |
customopt :: String -> ClassOption Source #
draft :: ClassOption Source #
landscape :: ClassOption Source #
Changes the layout of the document to print in landscape mode
openright :: ClassOption Source #
Makes chapters begin either only on right hand pages
openany :: ClassOption Source #
Makes chapters begin on the next page available.
fleqn :: ClassOption Source #
Typesets displayed formulae left-aligned instead of centred.
leqno :: ClassOption Source #
Places the numbering of formulae on the left hand side instead of the right.
Paper sizes
LaTeX available paper types.
Page styles
thispagestyle :: LaTeXC l => PageStyle -> l Source #
markboth :: LaTeXC l => l -> l -> l Source #
Used in conjunction with myheadings
for setting both the left and the right heading.
markright :: LaTeXC l => l -> l Source #
Used in conjunction with myheadings
for setting the right heading.
Body commands
Document structure
tableofcontents :: LaTeXC l => l Source #
Create the table of contents, automatically generated
from your section
s, subsection
s, and related functions.
Sections
subsection :: LaTeXC l => l -> l Source #
Start a new subsection.
subsection' :: LaTeXC l => l -> l Source #
Start a new unnumbered subsection.
subsubsection :: LaTeXC l => l -> l Source #
Start a new subsubsection.
subsubsection' :: LaTeXC l => l -> l Source #
Start a new unnumbered subsubsection.
subparagraph :: LaTeXC l => l -> l Source #
Start a subparagraph (minimal level of sectioning).
Logos & symbols
HaTeX specific
hatex_version :: LaTeXC l => l Source #
Print the HaTeX logo, beside the complete version number.
Document layout
lnbk :: LaTeXC l => l Source #
Start a new line. The exactly meaning depends on the context
where it is used. In normal running text when it forces a line
break it is essentially a shorthand for '\\newline' (does not end
horizontal mode or end the paragraph, it just inserts some glue and
penalties at that point into the horizontal material so that when
the paragraph does end a line break will occur at that point with
the short line padded with white space). In alignment environments
(like tabular
), it starts a new row, so use newline
instead to
start a new line.
lnbkspc :: LaTeXC l => Measure -> l Source #
Like lnbk
, introduces a line break. But it has an argument that
specifies how much extra vertical space is to be inserted before
the next line. This can be a negative amount.
cleardoublepage :: LaTeXC l => l Source #
linebreak :: LaTeXC l => l -> l Source #
Request to break the current line at the point of the command stretching the line so that it extends to the right margin. The number must be a number from 0 to 4. The higher the number, the more insistent the request is (0 means it will be easily ignored and 4 means do it anyway). When this line break option is used, LaTeX will try to produce the best line breaks possible.
nolinebreak :: LaTeXC l => l -> l Source #
Like linebreak
, but prevents a like break instead of requesting
one.
nopagebreak :: LaTeXC l => Maybe l -> l Source #
addvspace :: LaTeXC l => Measure -> l Source #
Add extra vertical white space. In a sequence of addvspace
the
length of the final white space is given by the maximum of the
individual lengths.
baselineskip :: LaTeXC l => l Source #
Document measures
textheight :: LaTeXC l => l Source #
Formatting text
verbatim :: LaTeXC l => Text -> l Source #
The point of verbatim
is to include text that will
not be parsed as LaTeX in any way at all, but should simply
appear as given in the document, in a separate display
in typewriter font.
verb :: LaTeXC l => Text -> l Source #
Include text, as given and in typewriter, but in-line. Note that, for LaTeX-specific technical reasons, verbatim text can generally only be used "at the top level", not in e.g. section titles or other command-arguments.
Unlike verbatim
, which LaTeX implements as an ordinary environment,
its command verb
uses a syntax trick to avoid braking its parsing
when the literal text contains a closing brace: rather than using braces
at all, the first character after \verb
will be the right delimiter as well.
Translating this method to HaTeX wouldn't really make sense since Haskell
has string literals with their own escaping possibilities; instead, we make
it secure by automatically choosing a delimiter that does not turn up
in the given string.
Fonts
textnormal :: LaTeXC l => l -> l Source #
Sizes
Sizes are sorted from smallest to biggest.
scriptsize :: LaTeXC l => l -> l Source #
footnotesize :: LaTeXC l => l -> l Source #
normalsize :: LaTeXC l => l -> l Source #
Environments
Math environments, such as equation
, defined in Text.LaTeX.Packages.AMSMath.
enumerate :: LaTeXC l => l -> l Source #
Environment of ordered lists. Use item
to start each list
item.
itemize :: LaTeXC l => l -> l Source #
Environment of unordered lists. Use item
to start each list
item.
flushright :: LaTeXC l => l -> l Source #
Right-justify the argument.
description :: LaTeXC l => l -> l Source #
Minipage environment.
:: LaTeXC l | |
=> Maybe Pos | Optional position. |
-> l | Figure content (should usually contain
|
-> l |
Figure environment. Use this for floating Text.LaTeX.Packages.Graphicx
content out of the text block and giving it a caption
. The figure can be
referred to with ref
from elsewhere in the document.
Page numbering
pagenumbering :: LaTeXC l => l -> l Source #
Boxes
Produce a simple black box.
Cross references
Tables
:: LaTeXC l | |
=> Maybe Pos | This optional parameter can be used to specify the vertical position of the table.
Defaulted to |
-> [TableSpec] | Table specification of columns and vertical lines. |
-> l | |
-> l | Resulting table syntax. |
The tabular
environment can be used to typeset tables with optional horizontal and vertical lines.
tabularnewline :: LaTeXC l => l Source #
tabularnewline
ends a row in array or tabular environments. The
'\' command has different meanings in different contexts. It can
end a line in normal text, or it can end an array or tabular
line. It may be preferrable to use newline
and in the first case,
and tabularnewline
in the second.
tabularnewlineSpc :: LaTeXC l => Measure -> l Source #
arraybackslash :: LaTeXC l => l Source #
arraybackslash
resets the definition of '\' to tabularnewline
.
:: LaTeXC l | |
=> Maybe Pos | This optional parameter can be used to specify the vertical position of the table.
Defaulted to |
-> [TableSpec] | Table specification of columns and vertical lines. |
-> l | |
-> l | Resulting table syntax. |
Like tabular
but in math mode by default
cline :: LaTeXC l => Int -> Int -> l Source #
cline i j
writes a partial horizontal line beginning in column i
and ending in column j
.
Special tables
:: (LaTeXC l, Texy a) | |
=> [l] | (Non-empty) List of column titles |
-> Matrix a | Matrix of data |
-> l | Data organized in a tabular environment |
If you are able to arrange some data in matrix form, you
might want to use this function to quickly generate a
tabular with your data. Each element of the matrix is
rendered using the Texy
instance of its type. If you
want a custom instance for an already instantiated type,
wrap that type using newtype
, and then create your own
instance. Since every element of a matrix must be of the
same type, for mixed tables you might want to create an
union type. For example, if your data matrix contains
Int
s and Double
s:
data Number = R Double | I Int instance Texy Number where texy (R x) = texy x texy (I x) = texy x
Now you can have a matrix of type Matrix Number
and use it
to render your mixed data in a LaTeX table.
The function matrixTabular
does not give you many options,
so it is not as flexible as generating the table by yourself,
but it uses a reasonable standard style.
A very simple example:
matrixTabular (fmap textbf ["x","y","z"]) $ fromList 3 3 [ (1 :: Int)..]
This code generates the following table:
For more examples see the file Examples/tables.hs
, included
in the source distribution.
For more info about how to generate and manipulate matrices, see Data.Matrix.
Others
raggedleft :: LaTeXC l => l Source #
raggedright :: LaTeXC l => l Source #
footnotemark :: LaTeXC l => l Source #
Prints a foot note mark but without the actual footnote.
footnotetext :: LaTeXC l => l -> l Source #
Prints the footnote corresponding to the previous footnotemark. Useful when dealing with footnotes in tabular environment.
stepcounter :: LaTeXC l => String -> l Source #
Increases by 1 the value of given counter
hyphenation :: LaTeXC l => l -> l Source #
Maths commands
module Text.LaTeX.Base.Math