@@ -49,8 +49,7 @@ import Text.Pandoc.Highlighting (highlight, styleToLaTeX,
4949data WriterState =
5050 WriterState { stInNote :: Bool -- true if we're in a note
5151 , stInTable :: Bool -- true if we're in a table
52− , stTableNotes :: [(Char, Doc)] -- List of markers, notes
53− -- in current table
52+ , stTableNotes :: [Doc] -- List of notes in current table
5453 , stOLLevel :: Int -- level of ordered list nesting
5554 , stOptions :: WriterOptions -- writer options, so they don't have to be parameter
5655 , stVerbInNote :: Bool -- true if document has verbatim text in note
@@ -382,27 +381,27 @@ blockToLaTeX (Table caption aligns widths heads rows) = do
382381 modify $ \s -> s{ stInTable = True, stTableNotes = [] }
383382 headers <- if all null heads
384383 then return empty
385− else liftM ($$ "\\ML")
386− $ (tableRowToLaTeX True aligns widths) heads
384+ else ($$ "\\hline\\endhead\\noalign{\\medskip}") `fmap`
385+ (tableRowToLaTeX True aligns widths) heads
387386 captionText <- inlineListToLaTeX caption
388387 let capt = if isEmpty captionText
389388 then empty
390− else text "caption = {" <> captionText <> "}," <> space
389+ else text "\\noalign{\\medskip}"
390+ $$ text "\\caption" <> braces captionText
391391 rows' <- mapM (tableRowToLaTeX False aligns widths) rows
392− let rows'' = intersperse ("\\\\\\noalign{\\medskip}") rows'
393392 tableNotes <- liftM (reverse . stTableNotes) get
394− let toNote (marker, x) = "\\tnote" <> brackets (char marker) <>
395− braces (nest 2 x)
393+ let toNote x = "\\footnotetext" <> braces (nest 2 x)
396394 let notes = vcat $ map toNote tableNotes
397395 let colDescriptors = text $ concat $ map toColDescriptor aligns
398− let tableBody =
399− ("\\ctable" <> brackets (capt <> text "pos = H, center, botcap"))
400− <> braces colDescriptors
401− $$ braces ("% notes" <> cr <> notes <> cr)
402− $$ braces (text "% rows" $$ "\\FL" $$
403− vcat (headers : rows'') $$ "\\LL" <> cr)
404396 modify $ \s -> s{ stTable = True, stInTable = False, stTableNotes = [] }
405− return $ tableBody
397+ return $ "\\begin{longtable}[c]" <> braces colDescriptors
398+ $$ "\\hline\\noalign{\\medskip}"
399+ $$ headers
400+ $$ vcat rows'
401+ $$ "\\hline"
402+ $$ capt
403+ $$ notes
404+ $$ "\\end{longtable}"
406405
407406toColDescriptor :: Alignment -> String
408407toColDescriptor align =
@@ -433,7 +432,7 @@ tableRowToLaTeX header aligns widths cols = do
433432 braces (text (printf "%.2f\\columnwidth" w)) <>
434433 braces (halign a <> cr <> c <> cr)
435434 let cells = zipWith3 toCell widths aligns renderedCells
436− return $ hcat $ intersperse (" & ") cells
435+ return $ hsep (intersperse "&" cells) $$ "\\\\\\noalign{\\medskip}"
437436
438437listItemToLaTeX :: [Block] -> State WriterState Doc
439438listItemToLaTeX lst = blockListToLaTeX lst >>= return . (text "\\item" $$) .
@@ -600,9 +599,8 @@ inlineToLaTeX (Note contents) = do
600599 if inTable
601600 then do
602601 curnotes <- liftM stTableNotes get
603− let marker = cycle ['a'..'z'] !! length curnotes
604− modify $ \s -> s{ stTableNotes = (marker, contents') : curnotes }
605− return $ "\\tmark" <> brackets (char marker) <> space
602+ modify $ \s -> s{ stTableNotes = contents' : curnotes }
603+ return $ "\\footnotemark" <> space
606604 else return $ "\\footnote" <> braces (nest 2 contents' <> optnl)
607605 -- note: a \n before } needed when note ends with a Verbatim environment
608606