highlighting-kate-0.5.2: Syntax highlighting

MaintainerJohn MacFarlane <jgm@berkeley.edu>
Safe HaskellSafe-Infered



Formatters that convert a list of annotated source lines to LaTeX.



formatLaTeXInline :: FormatOptions -> [SourceLine] -> StringSource

Formats tokens as LaTeX using custom commands inside | characters. Assumes that | is defined as a short verbatim command by the macros produced by styleToLaTeX. A KeywordTok is rendered using \KeywordTok{..}, and so on.

formatLaTeXBlock :: FormatOptions -> [SourceLine] -> StringSource

Format tokens as a LaTeX Highlighting environment inside a Shaded environment. Highlighting and Shaded are defined by the macros produced by styleToLaTeX. Highlighting is a verbatim environment using fancyvrb; \, {, and } have their normal meanings inside this environment, so that formatting commands work. Shaded is either nothing (if the style's background color is default) or a snugshade environment from framed, providing a background color for the whole code block, even if it spans multiple pages.

styleToLaTeX :: Style -> StringSource

Converts a Style to a set of LaTeX macro definitions, which should be placed in the document's preamble. Note: default LaTeX setup doesn't allow boldface typewriter font. To make boldface work in styles, you need to use a different typewriter font. This will work for computer modern:


Or, with xelatex:

 \setmainfont[SmallCapsFont={* Caps}]{Latin Modern Roman}
 \setsansfont{Latin Modern Sans}
 \setmonofont[SmallCapsFont={Latin Modern Mono Caps}]{Latin Modern Mono Light}