2010-12-19 10:13:55 -08:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
2007-11-03 23:27:58 +00:00
|
|
|
{-
|
2010-03-23 13:31:09 -07:00
|
|
|
Copyright (C) 2006-2010 John MacFarlane <jgm@berkeley.edu>
|
2007-11-03 23:27:58 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
-}
|
|
|
|
|
|
|
|
{- |
|
|
|
|
Module : Text.Pandoc.Writers.LaTeX
|
2010-03-23 13:31:09 -07:00
|
|
|
Copyright : Copyright (C) 2006-2010 John MacFarlane
|
2011-12-23 18:05:14 -08:00
|
|
|
License : GNU GPL, version 2 or above
|
2007-11-03 23:27:58 +00:00
|
|
|
|
|
|
|
Maintainer : John MacFarlane <jgm@berkeley.edu>
|
2011-12-23 18:05:14 -08:00
|
|
|
Stability : alpha
|
2007-11-03 23:27:58 +00:00
|
|
|
Portability : portable
|
|
|
|
|
|
|
|
Conversion of 'Pandoc' format into LaTeX.
|
|
|
|
-}
|
|
|
|
module Text.Pandoc.Writers.LaTeX ( writeLaTeX ) where
|
|
|
|
import Text.Pandoc.Definition
|
2010-12-24 13:39:27 -08:00
|
|
|
import Text.Pandoc.Generic
|
2007-11-03 23:27:58 +00:00
|
|
|
import Text.Pandoc.Shared
|
2009-12-31 01:08:56 +00:00
|
|
|
import Text.Pandoc.Templates
|
2007-11-03 23:27:58 +00:00
|
|
|
import Text.Printf ( printf )
|
2011-07-16 14:04:19 -07:00
|
|
|
import Network.URI ( isAbsoluteURI, unEscapeString )
|
2011-07-23 13:11:39 -07:00
|
|
|
import Data.List ( (\\), isSuffixOf, isInfixOf,
|
|
|
|
isPrefixOf, intercalate, intersperse )
|
2010-12-15 12:06:14 +01:00
|
|
|
import Data.Char ( toLower, isPunctuation )
|
2007-11-03 23:27:58 +00:00
|
|
|
import Control.Monad.State
|
2010-12-19 10:13:55 -08:00
|
|
|
import Text.Pandoc.Pretty
|
2010-12-15 11:40:53 +01:00
|
|
|
import System.FilePath (dropExtension)
|
2012-01-23 13:25:55 -08:00
|
|
|
import Text.Pandoc.Slides
|
2011-12-27 23:46:23 -08:00
|
|
|
import Text.Pandoc.Highlighting (highlight, styleToLaTeX,
|
2011-12-26 22:49:50 -08:00
|
|
|
formatLaTeXInline, formatLaTeXBlock)
|
2007-11-03 23:27:58 +00:00
|
|
|
|
2011-12-23 18:05:14 -08:00
|
|
|
data WriterState =
|
2011-12-30 16:14:35 -08:00
|
|
|
WriterState { stInNote :: Bool -- true if we're in a note
|
|
|
|
, stInTable :: Bool -- true if we're in a table
|
|
|
|
, stTableNotes :: [(Char, Doc)] -- List of markers, notes
|
|
|
|
-- in current table
|
|
|
|
, stOLLevel :: Int -- level of ordered list nesting
|
|
|
|
, stOptions :: WriterOptions -- writer options, so they don't have to be parameter
|
|
|
|
, stVerbInNote :: Bool -- true if document has verbatim text in note
|
|
|
|
, stEnumerate :: Bool -- true if document needs fancy enumerated lists
|
|
|
|
, stTable :: Bool -- true if document has a table
|
|
|
|
, stStrikeout :: Bool -- true if document has strikeout
|
|
|
|
, stSubscript :: Bool -- true if document has subscript
|
|
|
|
, stUrl :: Bool -- true if document has visible URL link
|
|
|
|
, stGraphics :: Bool -- true if document contains images
|
|
|
|
, stLHS :: Bool -- true if document has literate haskell code
|
|
|
|
, stBook :: Bool -- true if document uses book or memoir class
|
|
|
|
, stCsquotes :: Bool -- true if document uses csquotes
|
|
|
|
, stHighlighting :: Bool -- true if document has highlighted code
|
|
|
|
, stIncremental :: Bool -- true if beamer lists should be displayed bit by bit
|
|
|
|
, stInternalLinks :: [String] -- list of internal link targets
|
2007-11-15 03:11:33 +00:00
|
|
|
}
|
2007-11-03 23:27:58 +00:00
|
|
|
|
|
|
|
-- | Convert Pandoc to LaTeX.
|
|
|
|
writeLaTeX :: WriterOptions -> Pandoc -> String
|
2011-12-23 18:05:14 -08:00
|
|
|
writeLaTeX options document =
|
|
|
|
evalState (pandocToLaTeX options document) $
|
2011-07-10 09:13:10 -07:00
|
|
|
WriterState { stInNote = False, stInTable = False,
|
|
|
|
stTableNotes = [], stOLLevel = 1, stOptions = options,
|
2010-03-17 06:53:38 +00:00
|
|
|
stVerbInNote = False, stEnumerate = False,
|
2009-12-31 01:18:14 +00:00
|
|
|
stTable = False, stStrikeout = False, stSubscript = False,
|
2010-01-05 08:36:02 +00:00
|
|
|
stUrl = False, stGraphics = False,
|
2011-07-23 13:11:39 -07:00
|
|
|
stLHS = False, stBook = writerChapters options,
|
2011-12-29 13:24:05 -08:00
|
|
|
stCsquotes = False, stHighlighting = False,
|
2012-01-23 13:25:55 -08:00
|
|
|
stIncremental = writerIncremental options,
|
2011-12-30 16:14:35 -08:00
|
|
|
stInternalLinks = [] }
|
2007-11-03 23:27:58 +00:00
|
|
|
|
2009-12-31 01:08:56 +00:00
|
|
|
pandocToLaTeX :: WriterOptions -> Pandoc -> State WriterState String
|
|
|
|
pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do
|
2011-12-30 16:14:35 -08:00
|
|
|
-- see if there are internal links
|
|
|
|
let isInternalLink (Link _ ('#':xs,_)) = [xs]
|
|
|
|
isInternalLink _ = []
|
|
|
|
modify $ \s -> s{ stInternalLinks = queryWith isInternalLink blocks }
|
2010-01-03 08:47:54 +00:00
|
|
|
let template = writerTemplate options
|
2011-12-30 09:56:09 -08:00
|
|
|
-- set stBook depending on documentclass
|
|
|
|
let bookClasses = ["memoir","book","report","scrreprt","scrbook"]
|
|
|
|
case lookup "documentclass" (writerVariables options) of
|
|
|
|
Just x | x `elem` bookClasses -> modify $ \s -> s{stBook = True}
|
|
|
|
| otherwise -> return ()
|
|
|
|
Nothing | any (\x -> "\\documentclass" `isPrefixOf` x &&
|
|
|
|
(any (`isSuffixOf` x) bookClasses))
|
|
|
|
(lines template) -> modify $ \s -> s{stBook = True}
|
|
|
|
| otherwise -> return ()
|
2011-07-23 13:11:39 -07:00
|
|
|
-- check for \usepackage...{csquotes}; if present, we'll use
|
|
|
|
-- \enquote{...} for smart quotes:
|
|
|
|
when ("{csquotes}" `isInfixOf` template) $
|
|
|
|
modify $ \s -> s{stCsquotes = True}
|
2011-12-29 13:24:05 -08:00
|
|
|
let colwidth = if writerWrapText options
|
|
|
|
then Just $ writerColumns options
|
2010-12-19 10:13:55 -08:00
|
|
|
else Nothing
|
|
|
|
titletext <- liftM (render colwidth) $ inlineListToLaTeX title
|
|
|
|
authorsText <- mapM (liftM (render colwidth) . inlineListToLaTeX) authors
|
|
|
|
dateText <- liftM (render colwidth) $ inlineListToLaTeX date
|
2010-12-15 13:50:21 +01:00
|
|
|
let (blocks', lastHeader) = if writerCiteMethod options == Citeproc then
|
|
|
|
(blocks, [])
|
|
|
|
else case last blocks of
|
|
|
|
Header 1 il -> (init blocks, il)
|
|
|
|
_ -> (blocks, [])
|
2011-12-29 13:24:05 -08:00
|
|
|
blocks'' <- if writerBeamer options
|
|
|
|
then toSlides blocks'
|
|
|
|
else return blocks'
|
2011-12-30 14:30:45 -08:00
|
|
|
body <- mapM (elementToLaTeX options) $ hierarchicalize blocks''
|
2010-12-19 10:13:55 -08:00
|
|
|
biblioTitle <- liftM (render colwidth) $ inlineListToLaTeX lastHeader
|
2011-12-30 16:28:44 -08:00
|
|
|
let main = render colwidth $ vcat body
|
2009-12-31 01:18:14 +00:00
|
|
|
st <- get
|
2010-12-15 13:50:21 +01:00
|
|
|
let biblioFiles = intercalate "," $ map dropExtension $ writerBiblioFiles options
|
2010-12-13 21:18:01 +01:00
|
|
|
citecontext = case writerCiteMethod options of
|
2010-12-15 13:50:21 +01:00
|
|
|
Natbib -> [ ("biblio-files", biblioFiles)
|
|
|
|
, ("biblio-title", biblioTitle)
|
2010-12-13 21:18:01 +01:00
|
|
|
, ("natbib", "yes")
|
|
|
|
]
|
2010-12-15 13:50:21 +01:00
|
|
|
Biblatex -> [ ("biblio-files", biblioFiles)
|
|
|
|
, ("biblio-title", biblioTitle)
|
2010-12-13 21:18:01 +01:00
|
|
|
, ("biblatex", "yes")
|
|
|
|
]
|
|
|
|
_ -> []
|
|
|
|
context = writerVariables options ++
|
2009-12-31 01:10:17 +00:00
|
|
|
[ ("toc", if writerTableOfContents options then "yes" else "")
|
2009-12-31 01:08:56 +00:00
|
|
|
, ("body", main)
|
|
|
|
, ("title", titletext)
|
2011-12-29 13:24:05 -08:00
|
|
|
, ("date", dateText)
|
|
|
|
, ("documentclass", if writerBeamer options
|
|
|
|
then "beamer"
|
|
|
|
else if writerChapters options
|
|
|
|
then "book"
|
|
|
|
else "article") ] ++
|
2009-12-31 01:18:14 +00:00
|
|
|
[ ("author", a) | a <- authorsText ] ++
|
|
|
|
[ ("verbatim-in-note", "yes") | stVerbInNote st ] ++
|
|
|
|
[ ("fancy-enums", "yes") | stEnumerate st ] ++
|
|
|
|
[ ("tables", "yes") | stTable st ] ++
|
|
|
|
[ ("strikeout", "yes") | stStrikeout st ] ++
|
|
|
|
[ ("subscript", "yes") | stSubscript st ] ++
|
|
|
|
[ ("url", "yes") | stUrl st ] ++
|
2010-01-31 01:07:58 +00:00
|
|
|
[ ("numbersections", "yes") | writerNumberSections options ] ++
|
2009-12-31 21:18:36 +00:00
|
|
|
[ ("lhs", "yes") | stLHS st ] ++
|
2010-12-13 21:18:01 +01:00
|
|
|
[ ("graphics", "yes") | stGraphics st ] ++
|
2010-12-15 13:50:21 +01:00
|
|
|
[ ("book-class", "yes") | stBook st] ++
|
2011-12-23 18:26:03 -08:00
|
|
|
[ ("listings", "yes") | writerListings options || stLHS st ] ++
|
2011-12-29 13:24:05 -08:00
|
|
|
[ ("beamer", "yes") | writerBeamer options ] ++
|
2011-12-27 23:46:23 -08:00
|
|
|
[ ("highlighting-macros", styleToLaTeX
|
2011-12-29 13:24:05 -08:00
|
|
|
$ writerHighlightStyle options ) | stHighlighting st ] ++
|
2010-12-13 21:18:01 +01:00
|
|
|
citecontext
|
2009-12-31 01:12:59 +00:00
|
|
|
return $ if writerStandalone options
|
2010-01-03 08:47:54 +00:00
|
|
|
then renderTemplate context template
|
2009-12-31 01:12:59 +00:00
|
|
|
else main
|
2007-11-03 23:27:58 +00:00
|
|
|
|
2011-12-30 14:30:45 -08:00
|
|
|
-- | Convert Elements to LaTeX
|
|
|
|
elementToLaTeX :: WriterOptions -> Element -> State WriterState Doc
|
|
|
|
elementToLaTeX _ (Blk block) = blockToLaTeX block
|
|
|
|
elementToLaTeX opts (Sec level _ id' title' elements) = do
|
|
|
|
header' <- sectionHeader id' level title'
|
|
|
|
innerContents <- mapM (elementToLaTeX opts) elements
|
2011-12-30 16:28:44 -08:00
|
|
|
return $ vcat (header' : innerContents)
|
2007-11-03 23:27:58 +00:00
|
|
|
|
2011-12-30 14:30:45 -08:00
|
|
|
-- escape things as needed for LaTeX
|
2011-10-01 22:21:39 -07:00
|
|
|
stringToLaTeX :: Bool -> String -> String
|
|
|
|
stringToLaTeX isUrl = escapeStringUsing latexEscapes
|
|
|
|
where latexEscapes = backslashEscapes "{}$%&_" ++
|
|
|
|
if isUrl
|
|
|
|
then []
|
|
|
|
else [ ('~', "\\ensuremath{\\sim}")
|
|
|
|
, ('#', "\\#")
|
|
|
|
] ++
|
2007-11-03 23:27:58 +00:00
|
|
|
[ ('^', "\\^{}")
|
|
|
|
, ('\\', "\\textbackslash{}")
|
2011-09-23 14:58:16 -07:00
|
|
|
, ('€', "\\euro{}")
|
2007-11-03 23:27:58 +00:00
|
|
|
, ('|', "\\textbar{}")
|
|
|
|
, ('<', "\\textless{}")
|
|
|
|
, ('>', "\\textgreater{}")
|
2010-10-24 19:31:06 -07:00
|
|
|
, ('[', "{[}") -- to avoid interpretation as
|
|
|
|
, (']', "{]}") -- optional arguments
|
2008-07-11 01:24:15 +00:00
|
|
|
, ('\160', "~")
|
2010-11-27 11:53:30 -08:00
|
|
|
, ('\x2018', "`")
|
|
|
|
, ('\x2019', "'")
|
|
|
|
, ('\x201C', "``")
|
|
|
|
, ('\x201D', "''")
|
2011-12-26 22:49:50 -08:00
|
|
|
, ('\x2026', "\\ldots{}")
|
2011-12-27 15:45:34 -08:00
|
|
|
, ('\x2014', "---")
|
|
|
|
, ('\x2013', "--")
|
2007-11-03 23:27:58 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
-- | Puts contents into LaTeX command.
|
|
|
|
inCmd :: String -> Doc -> Doc
|
|
|
|
inCmd cmd contents = char '\\' <> text cmd <> braces contents
|
|
|
|
|
2011-12-29 13:24:05 -08:00
|
|
|
toSlides :: [Block] -> State WriterState [Block]
|
2012-01-23 13:25:55 -08:00
|
|
|
toSlides bs = concat `fmap` (mapM slideToBeamer $ toSlideElements bs)
|
|
|
|
|
|
|
|
slideToBeamer :: SlideElement -> State WriterState [Block]
|
|
|
|
slideToBeamer (SectionSlide lvl tit) = return [Header lvl tit]
|
|
|
|
slideToBeamer (ContentSlide tit bs) = do
|
|
|
|
tit' <- inlineListToLaTeX tit
|
2011-12-29 13:24:05 -08:00
|
|
|
-- note: [fragile] is required or verbatim breaks
|
2012-01-23 21:03:10 -08:00
|
|
|
let hasCodeBlock (CodeBlock _ _) = [True]
|
|
|
|
hasCodeBlock _ = []
|
|
|
|
let hasCode (Code _ _) = [True]
|
|
|
|
hasCode _ = []
|
|
|
|
let fragile = if not $ null $ queryWith hasCodeBlock bs ++ queryWith hasCode bs
|
|
|
|
then "[fragile]"
|
|
|
|
else ""
|
|
|
|
let slideStart = RawBlock "latex" ("\\begin{frame}" ++ fragile ++
|
2012-01-23 13:25:55 -08:00
|
|
|
"\\frametitle{" ++ render Nothing tit' ++ "}")
|
|
|
|
let slideEnd = RawBlock "latex" "\\end{frame}"
|
|
|
|
-- now carve up slide into blocks if there are sections inside
|
|
|
|
let eltToBlocks (Blk b) = [b]
|
|
|
|
eltToBlocks (Sec _ _ _ lab xs) =
|
|
|
|
Para (RawInline "latex" "\\begin{block}{" : lab ++ [RawInline "latex" "}"])
|
|
|
|
: concatMap eltToBlocks xs ++ [RawBlock "latex" "\\end{block}"]
|
|
|
|
return $ slideStart : concatMap eltToBlocks (hierarchicalize bs) ++ [slideEnd]
|
2011-12-29 13:24:05 -08:00
|
|
|
|
|
|
|
isListBlock :: Block -> Bool
|
|
|
|
isListBlock (BulletList _) = True
|
|
|
|
isListBlock (OrderedList _ _) = True
|
|
|
|
isListBlock (DefinitionList _) = True
|
|
|
|
isListBlock _ = False
|
|
|
|
|
2007-11-03 23:27:58 +00:00
|
|
|
-- | Convert Pandoc block element to LaTeX.
|
|
|
|
blockToLaTeX :: Block -- ^ Block to convert
|
|
|
|
-> State WriterState Doc
|
|
|
|
blockToLaTeX Null = return empty
|
2010-12-19 10:13:55 -08:00
|
|
|
blockToLaTeX (Plain lst) = inlineListToLaTeX lst
|
2010-03-16 04:06:33 +00:00
|
|
|
blockToLaTeX (Para [Image txt (src,tit)]) = do
|
2011-07-22 12:19:34 -07:00
|
|
|
capt <- inlineListToLaTeX txt
|
2010-03-16 04:06:33 +00:00
|
|
|
img <- inlineToLaTeX (Image txt (src,tit))
|
2011-02-11 19:03:46 -08:00
|
|
|
return $ "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$
|
2010-12-19 10:21:16 -08:00
|
|
|
("\\caption{" <> capt <> char '}') $$ "\\end{figure}" $$ blankline
|
2007-11-15 03:11:33 +00:00
|
|
|
blockToLaTeX (Para lst) = do
|
2010-12-19 10:13:55 -08:00
|
|
|
result <- inlineListToLaTeX lst
|
|
|
|
return $ result <> blankline
|
2007-11-03 23:27:58 +00:00
|
|
|
blockToLaTeX (BlockQuote lst) = do
|
2011-12-29 13:24:05 -08:00
|
|
|
beamer <- writerBeamer `fmap` gets stOptions
|
|
|
|
case lst of
|
|
|
|
[b] | beamer && isListBlock b -> do
|
|
|
|
oldIncremental <- gets stIncremental
|
|
|
|
modify $ \s -> s{ stIncremental = True }
|
|
|
|
result <- blockToLaTeX b
|
|
|
|
modify $ \s -> s{ stIncremental = oldIncremental }
|
|
|
|
return result
|
|
|
|
_ -> do
|
|
|
|
contents <- blockListToLaTeX lst
|
|
|
|
return $ "\\begin{quote}" $$ contents $$ "\\end{quote}"
|
2011-01-17 23:54:51 +01:00
|
|
|
blockToLaTeX (CodeBlock (_,classes,keyvalAttr) str) = do
|
2011-12-23 18:05:14 -08:00
|
|
|
opts <- gets stOptions
|
|
|
|
case () of
|
|
|
|
_ | writerLiterateHaskell opts && "haskell" `elem` classes &&
|
|
|
|
"literate" `elem` classes -> lhsCodeBlock
|
|
|
|
| writerListings opts -> listingsCodeBlock
|
|
|
|
| writerHighlight opts && not (null classes) -> highlightedCodeBlock
|
|
|
|
| otherwise -> rawCodeBlock
|
|
|
|
where lhsCodeBlock = do
|
|
|
|
modify $ \s -> s{ stLHS = True }
|
|
|
|
return $ flush ("\\begin{code}" $$ text str $$ "\\end{code}") $$ cr
|
|
|
|
rawCodeBlock = do
|
|
|
|
st <- get
|
|
|
|
env <- if stInNote st
|
|
|
|
then modify (\s -> s{ stVerbInNote = True }) >>
|
|
|
|
return "Verbatim"
|
|
|
|
else return "verbatim"
|
2011-12-27 15:45:34 -08:00
|
|
|
return $ flush (text ("\\begin{" ++ env ++ "}") $$ text str $$
|
|
|
|
text ("\\end{" ++ env ++ "}")) $$ cr -- final cr because of notes
|
2011-12-23 18:05:14 -08:00
|
|
|
listingsCodeBlock = do
|
|
|
|
st <- get
|
|
|
|
let params = if writerListings (stOptions st)
|
|
|
|
then take 1
|
|
|
|
[ "language=" ++ lang | lang <- classes
|
|
|
|
, lang `elem` ["ABAP","IDL","Plasm","ACSL","inform"
|
|
|
|
,"POV","Ada","Java","Prolog","Algol"
|
|
|
|
,"JVMIS","Promela","Ant","ksh","Python"
|
|
|
|
,"Assembler","Lisp","R","Awk","Logo"
|
|
|
|
,"Reduce","bash","make","Rexx","Basic"
|
|
|
|
,"Mathematica","RSL","C","Matlab","Ruby"
|
|
|
|
,"C++","Mercury","S","Caml","MetaPost"
|
|
|
|
,"SAS","Clean","Miranda","Scilab","Cobol"
|
|
|
|
,"Mizar","sh","Comal","ML","SHELXL","csh"
|
|
|
|
,"Modula-2","Simula","Delphi","MuPAD"
|
|
|
|
,"SQL","Eiffel","NASTRAN","tcl","Elan"
|
|
|
|
,"Oberon-2","TeX","erlang","OCL"
|
|
|
|
,"VBScript","Euphoria","Octave","Verilog"
|
|
|
|
,"Fortran","Oz","VHDL","GCL","Pascal"
|
|
|
|
,"VRML","Gnuplot","Perl","XML","Haskell"
|
|
|
|
,"PHP","XSLT","HTML","PL/I"]
|
|
|
|
] ++
|
|
|
|
[ key ++ "=" ++ attr | (key,attr) <- keyvalAttr ]
|
|
|
|
else []
|
|
|
|
printParams
|
|
|
|
| null params = empty
|
|
|
|
| otherwise = brackets $ hsep (intersperse "," (map text params))
|
|
|
|
return $ flush ("\\begin{lstlisting}" <> printParams $$ text str $$
|
|
|
|
"\\end{lstlisting}") $$ cr
|
|
|
|
highlightedCodeBlock =
|
2011-12-26 22:49:50 -08:00
|
|
|
case highlight formatLaTeXBlock ("",classes,keyvalAttr) str of
|
2011-12-23 18:05:14 -08:00
|
|
|
Nothing -> rawCodeBlock
|
|
|
|
Just h -> modify (\st -> st{ stHighlighting = True }) >>
|
2011-12-27 15:45:34 -08:00
|
|
|
return (flush $ text h)
|
2011-01-24 09:05:51 -08:00
|
|
|
blockToLaTeX (RawBlock "latex" x) = return $ text x <> blankline
|
2011-01-23 10:55:56 -08:00
|
|
|
blockToLaTeX (RawBlock _ _) = return empty
|
2007-11-03 23:27:58 +00:00
|
|
|
blockToLaTeX (BulletList lst) = do
|
2011-12-29 13:24:05 -08:00
|
|
|
incremental <- gets stIncremental
|
|
|
|
let inc = if incremental then "[<+->]" else ""
|
2007-11-03 23:27:58 +00:00
|
|
|
items <- mapM listItemToLaTeX lst
|
2011-12-29 13:24:05 -08:00
|
|
|
return $ text ("\\begin{itemize}" ++ inc) $$ vcat items $$ "\\end{itemize}"
|
2007-11-03 23:27:58 +00:00
|
|
|
blockToLaTeX (OrderedList (start, numstyle, numdelim) lst) = do
|
|
|
|
st <- get
|
2011-12-29 13:24:05 -08:00
|
|
|
let inc = if stIncremental st then "[<+->]" else ""
|
2007-11-03 23:27:58 +00:00
|
|
|
let oldlevel = stOLLevel st
|
|
|
|
put $ st {stOLLevel = oldlevel + 1}
|
|
|
|
items <- mapM listItemToLaTeX lst
|
2008-07-13 16:53:06 +00:00
|
|
|
modify (\s -> s {stOLLevel = oldlevel})
|
2009-12-31 01:18:14 +00:00
|
|
|
exemplar <- if numstyle /= DefaultStyle || numdelim /= DefaultDelim
|
|
|
|
then do
|
|
|
|
modify $ \s -> s{ stEnumerate = True }
|
2011-12-23 18:05:14 -08:00
|
|
|
return $ char '[' <>
|
2009-12-31 01:18:14 +00:00
|
|
|
text (head (orderedListMarkers (1, numstyle,
|
|
|
|
numdelim))) <> char ']'
|
|
|
|
else return empty
|
2007-11-03 23:27:58 +00:00
|
|
|
let resetcounter = if start /= 1 && oldlevel <= 4
|
2011-12-23 18:05:14 -08:00
|
|
|
then text $ "\\setcounter{enum" ++
|
2007-11-03 23:27:58 +00:00
|
|
|
map toLower (toRomanNumeral oldlevel) ++
|
|
|
|
"}{" ++ show (start - 1) ++ "}"
|
2011-12-23 18:05:14 -08:00
|
|
|
else empty
|
2011-12-29 13:24:05 -08:00
|
|
|
return $ text ("\\begin{enumerate}" ++ inc) <> exemplar $$ resetcounter $$
|
2010-12-19 10:21:16 -08:00
|
|
|
vcat items $$ "\\end{enumerate}"
|
2007-11-03 23:27:58 +00:00
|
|
|
blockToLaTeX (DefinitionList lst) = do
|
2011-12-29 13:24:05 -08:00
|
|
|
incremental <- gets stIncremental
|
|
|
|
let inc = if incremental then "[<+->]" else ""
|
2007-11-03 23:27:58 +00:00
|
|
|
items <- mapM defListItemToLaTeX lst
|
2011-12-29 13:24:05 -08:00
|
|
|
return $ text ("\\begin{description}" ++ inc) $$ vcat items $$ "\\end{description}"
|
2010-12-19 10:13:55 -08:00
|
|
|
blockToLaTeX HorizontalRule = return $
|
|
|
|
"\\begin{center}\\rule{3in}{0.4pt}\\end{center}" $$ blankline
|
2011-12-30 14:30:45 -08:00
|
|
|
blockToLaTeX (Header level lst) = sectionHeader "" level lst
|
2007-11-03 23:27:58 +00:00
|
|
|
blockToLaTeX (Table caption aligns widths heads rows) = do
|
2011-07-10 09:13:10 -07:00
|
|
|
modify $ \s -> s{ stInTable = True, stTableNotes = [] }
|
2010-03-01 02:28:03 +00:00
|
|
|
headers <- if all null heads
|
|
|
|
then return empty
|
2011-07-10 09:13:10 -07:00
|
|
|
else liftM ($$ "\\ML")
|
|
|
|
$ (tableRowToLaTeX True aligns widths) heads
|
2011-07-22 12:19:34 -07:00
|
|
|
captionText <- inlineListToLaTeX caption
|
2011-07-10 09:13:10 -07:00
|
|
|
let capt = if isEmpty captionText
|
|
|
|
then empty
|
|
|
|
else text "caption = " <> captionText <> "," <> space
|
|
|
|
rows' <- mapM (tableRowToLaTeX False aligns widths) rows
|
|
|
|
let rows'' = intersperse ("\\\\\\noalign{\\medskip}") rows'
|
|
|
|
tableNotes <- liftM (reverse . stTableNotes) get
|
|
|
|
let toNote (marker, x) = "\\tnote" <> brackets (char marker) <>
|
|
|
|
braces (nest 2 x)
|
|
|
|
let notes = vcat $ map toNote tableNotes
|
|
|
|
let colDescriptors = text $ concat $ map toColDescriptor aligns
|
|
|
|
let tableBody =
|
|
|
|
("\\ctable" <> brackets (capt <> text "pos = H, center, botcap"))
|
|
|
|
<> braces colDescriptors
|
|
|
|
$$ braces ("% notes" <> cr <> notes <> cr)
|
|
|
|
$$ braces (text "% rows" $$ "\\FL" $$
|
|
|
|
vcat (headers : rows'') $$ "\\LL" <> cr)
|
|
|
|
modify $ \s -> s{ stTable = True, stInTable = False, stTableNotes = [] }
|
|
|
|
return $ tableBody $$ blankline
|
2007-11-03 23:27:58 +00:00
|
|
|
|
2011-07-10 09:13:10 -07:00
|
|
|
toColDescriptor :: Alignment -> String
|
|
|
|
toColDescriptor align =
|
2009-11-28 03:22:33 +00:00
|
|
|
case align of
|
|
|
|
AlignLeft -> "l"
|
|
|
|
AlignRight -> "r"
|
|
|
|
AlignCenter -> "c"
|
|
|
|
AlignDefault -> "l"
|
|
|
|
|
2008-07-13 16:53:06 +00:00
|
|
|
blockListToLaTeX :: [Block] -> State WriterState Doc
|
2007-11-03 23:27:58 +00:00
|
|
|
blockListToLaTeX lst = mapM blockToLaTeX lst >>= return . vcat
|
|
|
|
|
2011-07-10 09:13:10 -07:00
|
|
|
tableRowToLaTeX :: Bool
|
|
|
|
-> [Alignment]
|
|
|
|
-> [Double]
|
|
|
|
-> [[Block]]
|
|
|
|
-> State WriterState Doc
|
|
|
|
tableRowToLaTeX header aligns widths cols = do
|
2011-01-14 14:45:04 -08:00
|
|
|
renderedCells <- mapM blockListToLaTeX cols
|
2011-07-10 09:13:10 -07:00
|
|
|
let valign = text $ if header then "[b]" else "[t]"
|
|
|
|
let halign x = case x of
|
|
|
|
AlignLeft -> "\\raggedright"
|
|
|
|
AlignRight -> "\\raggedleft"
|
|
|
|
AlignCenter -> "\\centering"
|
|
|
|
AlignDefault -> "\\raggedright"
|
|
|
|
let toCell 0 _ c = c
|
|
|
|
toCell w a c = "\\parbox" <> valign <>
|
|
|
|
braces (text (printf "%.2f\\columnwidth" w)) <>
|
|
|
|
braces (halign a <> cr <> c <> cr)
|
|
|
|
let cells = zipWith3 toCell widths aligns renderedCells
|
|
|
|
return $ hcat $ intersperse (" & ") cells
|
2007-11-03 23:27:58 +00:00
|
|
|
|
2008-07-13 16:53:06 +00:00
|
|
|
listItemToLaTeX :: [Block] -> State WriterState Doc
|
2008-08-09 16:50:46 +00:00
|
|
|
listItemToLaTeX lst = blockListToLaTeX lst >>= return . (text "\\item" $$) .
|
2007-11-03 23:27:58 +00:00
|
|
|
(nest 2)
|
|
|
|
|
2009-12-07 08:26:53 +00:00
|
|
|
defListItemToLaTeX :: ([Inline], [[Block]]) -> State WriterState Doc
|
|
|
|
defListItemToLaTeX (term, defs) = do
|
2011-07-22 12:19:34 -07:00
|
|
|
term' <- inlineListToLaTeX term
|
2010-12-19 10:13:55 -08:00
|
|
|
def' <- liftM vsep $ mapM blockListToLaTeX defs
|
2010-12-19 10:21:16 -08:00
|
|
|
return $ "\\item" <> brackets term' $$ def'
|
2007-11-03 23:27:58 +00:00
|
|
|
|
2011-12-30 14:30:45 -08:00
|
|
|
-- | Craft the section header, inserting the secton reference, if supplied.
|
|
|
|
sectionHeader :: [Char]
|
|
|
|
-> Int
|
|
|
|
-> [Inline]
|
|
|
|
-> State WriterState Doc
|
|
|
|
sectionHeader ref level lst = do
|
|
|
|
txt <- inlineListToLaTeX lst
|
|
|
|
let noNote (Note _) = Str ""
|
|
|
|
noNote x = x
|
|
|
|
let lstNoNotes = bottomUp noNote lst
|
|
|
|
-- footnotes in sections don't work unless you specify an optional
|
|
|
|
-- argument: \section[mysec]{mysec\footnote{blah}}
|
|
|
|
optional <- if lstNoNotes == lst
|
|
|
|
then return empty
|
|
|
|
else do
|
|
|
|
res <- inlineListToLaTeX lstNoNotes
|
|
|
|
return $ char '[' <> res <> char ']'
|
|
|
|
let stuffing = optional <> char '{' <> txt <> char '}'
|
|
|
|
book <- liftM stBook get
|
|
|
|
let level' = if book then level - 1 else level
|
2011-12-30 16:14:35 -08:00
|
|
|
internalLinks <- gets stInternalLinks
|
|
|
|
let refLabel lab = (if ref `elem` internalLinks
|
|
|
|
then text "\\hyperdef"
|
|
|
|
<> braces empty
|
|
|
|
<> braces (text ref)
|
|
|
|
<> braces (lab <> text "\\label"
|
|
|
|
<> braces (text ref))
|
|
|
|
else lab)
|
2011-12-30 14:30:45 -08:00
|
|
|
$$ blankline
|
|
|
|
let headerWith x y = refLabel $ text x <> y
|
|
|
|
return $ case level' of
|
|
|
|
0 -> headerWith "\\chapter" stuffing
|
|
|
|
1 -> headerWith "\\section" stuffing
|
|
|
|
2 -> headerWith "\\subsection" stuffing
|
|
|
|
3 -> headerWith "\\subsubsection" stuffing
|
|
|
|
4 -> headerWith "\\paragraph" stuffing
|
|
|
|
5 -> headerWith "\\subparagraph" stuffing
|
|
|
|
_ -> txt $$ blankline
|
|
|
|
|
|
|
|
|
2007-11-03 23:27:58 +00:00
|
|
|
-- | Convert list of inline elements to LaTeX.
|
|
|
|
inlineListToLaTeX :: [Inline] -- ^ Inlines to convert
|
|
|
|
-> State WriterState Doc
|
|
|
|
inlineListToLaTeX lst = mapM inlineToLaTeX lst >>= return . hcat
|
|
|
|
|
|
|
|
isQuoted :: Inline -> Bool
|
|
|
|
isQuoted (Quoted _ _) = True
|
|
|
|
isQuoted _ = False
|
|
|
|
|
|
|
|
-- | Convert inline element to LaTeX
|
|
|
|
inlineToLaTeX :: Inline -- ^ Inline to convert
|
|
|
|
-> State WriterState Doc
|
|
|
|
inlineToLaTeX (Emph lst) =
|
2011-07-22 12:19:34 -07:00
|
|
|
inlineListToLaTeX lst >>= return . inCmd "emph"
|
2011-12-23 18:05:14 -08:00
|
|
|
inlineToLaTeX (Strong lst) =
|
|
|
|
inlineListToLaTeX lst >>= return . inCmd "textbf"
|
2007-11-03 23:27:58 +00:00
|
|
|
inlineToLaTeX (Strikeout lst) = do
|
2011-07-22 12:19:34 -07:00
|
|
|
contents <- inlineListToLaTeX lst
|
2009-12-31 01:18:14 +00:00
|
|
|
modify $ \s -> s{ stStrikeout = True }
|
2007-11-03 23:27:58 +00:00
|
|
|
return $ inCmd "sout" contents
|
2009-12-31 01:18:14 +00:00
|
|
|
inlineToLaTeX (Superscript lst) =
|
2011-07-22 12:19:34 -07:00
|
|
|
inlineListToLaTeX lst >>= return . inCmd "textsuperscript"
|
2007-11-03 23:27:58 +00:00
|
|
|
inlineToLaTeX (Subscript lst) = do
|
2009-12-31 01:18:14 +00:00
|
|
|
modify $ \s -> s{ stSubscript = True }
|
2011-07-22 12:19:34 -07:00
|
|
|
contents <- inlineListToLaTeX lst
|
2007-11-03 23:27:58 +00:00
|
|
|
-- oddly, latex includes \textsuperscript but not \textsubscript
|
2008-06-08 03:29:09 +00:00
|
|
|
-- so we have to define it (using a different name so as not to conflict with memoir class):
|
|
|
|
return $ inCmd "textsubscr" contents
|
2008-07-15 23:26:06 +00:00
|
|
|
inlineToLaTeX (SmallCaps lst) =
|
2011-07-22 12:19:34 -07:00
|
|
|
inlineListToLaTeX lst >>= return . inCmd "textsc"
|
2010-12-13 21:18:01 +01:00
|
|
|
inlineToLaTeX (Cite cits lst) = do
|
|
|
|
st <- get
|
|
|
|
let opts = stOptions st
|
|
|
|
case writerCiteMethod opts of
|
|
|
|
Natbib -> citationsToNatbib cits
|
|
|
|
Biblatex -> citationsToBiblatex cits
|
|
|
|
_ -> inlineListToLaTeX lst
|
|
|
|
|
2011-12-23 18:37:52 -08:00
|
|
|
inlineToLaTeX (Code (_,classes,_) str) = do
|
|
|
|
opts <- gets stOptions
|
|
|
|
case () of
|
|
|
|
_ | writerListings opts -> listingsCode
|
|
|
|
| writerHighlight opts && not (null classes) -> highlightCode
|
|
|
|
| otherwise -> rawCode
|
|
|
|
where listingsCode = do
|
|
|
|
inNote <- gets stInNote
|
|
|
|
when inNote $ modify $ \s -> s{ stVerbInNote = True }
|
|
|
|
let chr = ((enumFromTo '!' '~') \\ str) !! 0
|
|
|
|
return $ text $ "\\lstinline" ++ [chr] ++ str ++ [chr]
|
|
|
|
highlightCode = do
|
2011-12-26 22:49:50 -08:00
|
|
|
case highlight formatLaTeXInline ("",classes,[]) str of
|
2011-12-23 18:37:52 -08:00
|
|
|
Nothing -> rawCode
|
|
|
|
Just h -> modify (\st -> st{ stHighlighting = True }) >>
|
|
|
|
return (text h)
|
|
|
|
rawCode = return
|
|
|
|
$ text $ "\\texttt{" ++ stringToLaTeX False str ++ "}"
|
2007-11-03 23:27:58 +00:00
|
|
|
inlineToLaTeX (Quoted SingleQuote lst) = do
|
|
|
|
contents <- inlineListToLaTeX lst
|
2011-07-23 13:11:39 -07:00
|
|
|
csquotes <- liftM stCsquotes get
|
|
|
|
if csquotes
|
|
|
|
then return $ "\\enquote" <> braces contents
|
|
|
|
else do
|
|
|
|
let s1 = if (not (null lst)) && (isQuoted (head lst))
|
|
|
|
then "\\,"
|
|
|
|
else empty
|
|
|
|
let s2 = if (not (null lst)) && (isQuoted (last lst))
|
|
|
|
then "\\,"
|
|
|
|
else empty
|
|
|
|
return $ char '`' <> s1 <> contents <> s2 <> char '\''
|
2007-11-03 23:27:58 +00:00
|
|
|
inlineToLaTeX (Quoted DoubleQuote lst) = do
|
|
|
|
contents <- inlineListToLaTeX lst
|
2011-07-23 13:11:39 -07:00
|
|
|
csquotes <- liftM stCsquotes get
|
|
|
|
if csquotes
|
|
|
|
then return $ "\\enquote" <> braces contents
|
|
|
|
else do
|
|
|
|
let s1 = if (not (null lst)) && (isQuoted (head lst))
|
|
|
|
then "\\,"
|
|
|
|
else empty
|
|
|
|
let s2 = if (not (null lst)) && (isQuoted (last lst))
|
|
|
|
then "\\,"
|
|
|
|
else empty
|
|
|
|
return $ "``" <> s1 <> contents <> s2 <> "''"
|
2011-10-01 22:21:39 -07:00
|
|
|
inlineToLaTeX (Str str) = return $ text $ stringToLaTeX False str
|
2008-08-13 03:02:42 +00:00
|
|
|
inlineToLaTeX (Math InlineMath str) = return $ char '$' <> text str <> char '$'
|
2010-12-19 10:21:16 -08:00
|
|
|
inlineToLaTeX (Math DisplayMath str) = return $ "\\[" <> text str <> "\\]"
|
2011-01-23 10:55:56 -08:00
|
|
|
inlineToLaTeX (RawInline "latex" str) = return $ text str
|
2011-01-24 22:13:27 -08:00
|
|
|
inlineToLaTeX (RawInline "tex" str) = return $ text str
|
2011-01-23 10:55:56 -08:00
|
|
|
inlineToLaTeX (RawInline _ _) = return empty
|
2010-12-19 10:21:16 -08:00
|
|
|
inlineToLaTeX (LineBreak) = return "\\\\"
|
2010-12-19 10:13:55 -08:00
|
|
|
inlineToLaTeX Space = return space
|
2010-01-05 08:36:02 +00:00
|
|
|
inlineToLaTeX (Link txt (src, _)) =
|
2007-11-03 23:27:58 +00:00
|
|
|
case txt of
|
2011-01-26 20:44:25 -08:00
|
|
|
[Code _ x] | x == src -> -- autolink
|
2009-12-31 01:18:14 +00:00
|
|
|
do modify $ \s -> s{ stUrl = True }
|
|
|
|
return $ text $ "\\url{" ++ x ++ "}"
|
2011-07-22 12:19:34 -07:00
|
|
|
_ -> do contents <- inlineListToLaTeX txt
|
2011-10-01 22:21:39 -07:00
|
|
|
return $ text ("\\href{" ++ stringToLaTeX True src ++ "}{") <>
|
2011-01-14 18:59:50 -08:00
|
|
|
contents <> char '}'
|
2009-12-31 01:18:14 +00:00
|
|
|
inlineToLaTeX (Image _ (source, _)) = do
|
|
|
|
modify $ \s -> s{ stGraphics = True }
|
2011-07-16 14:04:19 -07:00
|
|
|
let source' = if isAbsoluteURI source
|
|
|
|
then source
|
|
|
|
else unEscapeString source
|
|
|
|
return $ "\\includegraphics" <> braces (text source')
|
2007-11-03 23:27:58 +00:00
|
|
|
inlineToLaTeX (Note contents) = do
|
2010-12-19 10:13:55 -08:00
|
|
|
modify (\s -> s{stInNote = True})
|
2007-11-03 23:27:58 +00:00
|
|
|
contents' <- blockListToLaTeX contents
|
2008-07-13 16:53:06 +00:00
|
|
|
modify (\s -> s {stInNote = False})
|
2011-07-10 09:13:10 -07:00
|
|
|
inTable <- liftM stInTable get
|
|
|
|
if inTable
|
|
|
|
then do
|
|
|
|
curnotes <- liftM stTableNotes get
|
|
|
|
let marker = cycle ['a'..'z'] !! length curnotes
|
|
|
|
modify $ \s -> s{ stTableNotes = (marker, contents') : curnotes }
|
|
|
|
return $ "\\tmark" <> brackets (char marker) <> space
|
|
|
|
else return $ "\\footnote" <> braces (nest 2 contents')
|
|
|
|
-- note: a \n before } needed when note ends with a Verbatim environment
|
2010-12-13 21:18:01 +01:00
|
|
|
|
|
|
|
citationsToNatbib :: [Citation] -> State WriterState Doc
|
|
|
|
citationsToNatbib (one:[])
|
|
|
|
= citeCommand c p s k
|
|
|
|
where
|
|
|
|
Citation { citationId = k
|
|
|
|
, citationPrefix = p
|
|
|
|
, citationSuffix = s
|
|
|
|
, citationMode = m
|
|
|
|
}
|
|
|
|
= one
|
|
|
|
c = case m of
|
|
|
|
AuthorInText -> "citet"
|
|
|
|
SuppressAuthor -> "citeyearpar"
|
|
|
|
NormalCitation -> "citep"
|
|
|
|
|
|
|
|
citationsToNatbib cits
|
|
|
|
| noPrefix (tail cits) && noSuffix (init cits) && ismode NormalCitation cits
|
|
|
|
= citeCommand "citep" p s ks
|
|
|
|
where
|
|
|
|
noPrefix = and . map (null . citationPrefix)
|
|
|
|
noSuffix = and . map (null . citationSuffix)
|
|
|
|
ismode m = and . map (((==) m) . citationMode)
|
|
|
|
p = citationPrefix $ head $ cits
|
|
|
|
s = citationSuffix $ last $ cits
|
|
|
|
ks = intercalate ", " $ map citationId cits
|
|
|
|
|
|
|
|
citationsToNatbib (c:cs) | citationMode c == AuthorInText = do
|
|
|
|
author <- citeCommand "citeauthor" [] [] (citationId c)
|
|
|
|
cits <- citationsToNatbib (c { citationMode = SuppressAuthor } : cs)
|
|
|
|
return $ author <+> cits
|
|
|
|
|
|
|
|
citationsToNatbib cits = do
|
|
|
|
cits' <- mapM convertOne cits
|
|
|
|
return $ text "\\citetext{" <> foldl combineTwo empty cits' <> text "}"
|
|
|
|
where
|
|
|
|
combineTwo a b | isEmpty a = b
|
|
|
|
| otherwise = a <> text "; " <> b
|
|
|
|
convertOne Citation { citationId = k
|
|
|
|
, citationPrefix = p
|
|
|
|
, citationSuffix = s
|
|
|
|
, citationMode = m
|
|
|
|
}
|
|
|
|
= case m of
|
|
|
|
AuthorInText -> citeCommand "citealt" p s k
|
|
|
|
SuppressAuthor -> citeCommand "citeyear" p s k
|
|
|
|
NormalCitation -> citeCommand "citealp" p s k
|
|
|
|
|
|
|
|
citeCommand :: String -> [Inline] -> [Inline] -> String -> State WriterState Doc
|
|
|
|
citeCommand c p s k = do
|
|
|
|
args <- citeArguments p s k
|
|
|
|
return $ text ("\\" ++ c) <> args
|
|
|
|
|
|
|
|
citeArguments :: [Inline] -> [Inline] -> String -> State WriterState Doc
|
|
|
|
citeArguments p s k = do
|
2010-12-15 12:06:14 +01:00
|
|
|
let s' = case s of
|
|
|
|
(Str (x:[]) : r) | isPunctuation x -> dropWhile (== Space) r
|
|
|
|
(Str (x:xs) : r) | isPunctuation x -> Str xs : r
|
|
|
|
_ -> s
|
2010-12-13 21:18:01 +01:00
|
|
|
pdoc <- inlineListToLaTeX p
|
2010-12-15 12:06:14 +01:00
|
|
|
sdoc <- inlineListToLaTeX s'
|
2010-12-13 21:18:01 +01:00
|
|
|
let optargs = case (isEmpty pdoc, isEmpty sdoc) of
|
|
|
|
(True, True ) -> empty
|
|
|
|
(True, False) -> brackets sdoc
|
|
|
|
(_ , _ ) -> brackets pdoc <> brackets sdoc
|
|
|
|
return $ optargs <> braces (text k)
|
|
|
|
|
|
|
|
citationsToBiblatex :: [Citation] -> State WriterState Doc
|
|
|
|
citationsToBiblatex (one:[])
|
|
|
|
= citeCommand cmd p s k
|
|
|
|
where
|
|
|
|
Citation { citationId = k
|
|
|
|
, citationPrefix = p
|
|
|
|
, citationSuffix = s
|
|
|
|
, citationMode = m
|
|
|
|
} = one
|
|
|
|
cmd = case m of
|
|
|
|
SuppressAuthor -> "autocite*"
|
|
|
|
AuthorInText -> "textcite"
|
|
|
|
NormalCitation -> "autocite"
|
|
|
|
|
|
|
|
citationsToBiblatex (c:cs) = do
|
|
|
|
args <- mapM convertOne (c:cs)
|
|
|
|
return $ text cmd <> foldl (<>) empty args
|
|
|
|
where
|
|
|
|
cmd = case citationMode c of
|
|
|
|
AuthorInText -> "\\textcites"
|
|
|
|
_ -> "\\autocites"
|
|
|
|
convertOne Citation { citationId = k
|
|
|
|
, citationPrefix = p
|
|
|
|
, citationSuffix = s
|
|
|
|
}
|
|
|
|
= citeArguments p s k
|
|
|
|
|
|
|
|
citationsToBiblatex _ = return empty
|