packages feed

pandoc 2.11.3.1 → 2.11.3.2

raw patch · 27 files changed

+567/−173 lines, 27 filesdep ~citeprocdep ~texmathPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependency ranges changed: citeproc, texmath

API changes (from Hackage documentation)

+ Text.Pandoc.Writers.AnnotatedTable: instance Text.Pandoc.Walk.Walkable a Text.Pandoc.Definition.Cell => Text.Pandoc.Walk.Walkable a Text.Pandoc.Writers.AnnotatedTable.Cell
+ Text.Pandoc.Writers.AnnotatedTable: instance Text.Pandoc.Walk.Walkable a Text.Pandoc.Definition.Cell => Text.Pandoc.Walk.Walkable a Text.Pandoc.Writers.AnnotatedTable.HeaderRow
+ Text.Pandoc.Writers.AnnotatedTable: instance Text.Pandoc.Walk.Walkable a Text.Pandoc.Definition.Cell => Text.Pandoc.Walk.Walkable a Text.Pandoc.Writers.AnnotatedTable.TableHead

Files

AUTHORS.md view
@@ -128,6 +128,7 @@ - Jens Getreu - Jens Petersen - Jeroen de Haas+- Jerry Sky - Jesse Rosenthal - Joe Hermaszewski - Joe Hillenbrand@@ -302,6 +303,8 @@ - TEC - tgkokk - the-solipsist+- timo-a - thsutton - vijayphoenix - wiefling+- wuffi
MANUAL.txt view
@@ -1,7 +1,7 @@ --- title: Pandoc User's Guide author: John MacFarlane-date: December 17, 2020+date: December 29, 2020 ---  # Synopsis@@ -4463,8 +4463,8 @@  whereas `Markdown.pl` will preserve it as is. -There is one exception to this rule:  text between `<script>` and-`<style>` tags is not interpreted as Markdown.+There is one exception to this rule:  text between `<script>`,+`<style>`, and `<textarea>` tags is not interpreted as Markdown.  This departure from standard Markdown should make it easier to mix Markdown with HTML block elements.  For example, one can surround
cabal.project view
@@ -6,7 +6,3 @@   flags: +embed_data_files -trypandoc   ghc-options: -j +RTS -A64m -RTS --- source-repository-package---   type: git---   location: https://github.com/jgm/citeproc---   tag: a8193fe375fa2354049bf9a967ba3bad4b1ba053
changelog.md view
@@ -1,5 +1,59 @@ # Revision history for pandoc +## pandoc 2.11.3.2 (2020-12-29)++  * HTML reader: use renderTags' from Text.Pandoc.Shared (Albert Krewinkel).+    A side effect of this change is that empty `<col>` elements are written+    as self-closing tags in raw HTML blocks.++  * Asciidoc writer: Add support for writing nested tables (#6972, timo-a).+    Asciidoc supports one level of nesting. If deeper tables are to be+    written, they are omitted and a warning is issued.++  * Docx writer: fix nested tables with captions (#6983).+    Previously we got unreadable content, because docx seems+    to want a `<w:p>` element (even an empty one) at the end of+    every table cell.++  * Powerpoint writer: allow arbitrary OOXML in raw inline elements+    (Albert Krewinkel).  The raw text is now included verbatim in the+    output. Previously is was parsed into XML elements, which prevented+    the inclusion of partial XML snippets.++  * LaTeX writer: support colspans and rowspans in tables (#6950,+    Albert Krewinkel).  Note that the multirow package is needed for+    rowspans.  It is included in the latex template under a variable,+    so that it won't be used unless needed for a table.++  * HTML writer: don't include p tags in CSL bibliography entries+    (#6966).  Fixes a regression in 2.11.3.++  * Add `meta-description` variable to HTML templates (#6982). This+    is populated by the writer by stringifying the `description`+    field of metadata (Jerry Sky).  The `description` meta tag will+    make the generated HTML documents more complete and SEO-friendly.++  * Citeproc: fix handling of empty URL variables (`DOI`, etc.).+    The `linkifyVariables` function was changing these to links+    which then got treated as non-empty by citeproc, leading+    to wrong results (e.g. ignoring nonempty URL when empty DOI is present).+    See jgm/citeproc#41.++  * Use citeproc 0.3.0.3.  Fixes an issue in author-only citations when+    both an author and translator are present, and an issue with+    citation group delimiters.++  * Require texmath 0.12.1.  This improves siunitx support in math,+    fixes bugs with `\*mod` family operators and arrays, and avoids+    italicizing symbols and operator names in docx output.++  * Ensure that the perl interpreter used for filters with `.pl`+    extension (wuffi).++  * MANUAL: note that textarea content is never parsed as Markdown+    (Albert Krewinkel).++ ## pandoc 2.11.3.1 (2020-12-18)    * Added some missing files to extra-source-files and data
data/templates/default.html4 view
@@ -13,6 +13,9 @@ $if(keywords)$   <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" /> $endif$+$if(description-meta)$+  <meta name="description" content="$description-meta$" />+$endif$   <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>   <style type="text/css">     $styles.html()$
data/templates/default.html5 view
@@ -13,6 +13,9 @@ $if(keywords)$   <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" /> $endif$+$if(description-meta)$+  <meta name="description" content="$description-meta$" />+$endif$   <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>   <style>     $styles.html()$
data/templates/default.latex view
@@ -255,6 +255,9 @@ $endif$ $if(tables)$ \usepackage{longtable,booktabs,array}+$if(multirow)$+\usepackage{multirow}+$endif$ \usepackage{calc} % for calculating minipage widths $if(beamer)$ \usepackage{caption}
man/pandoc.1 view
@@ -1,7 +1,7 @@ '\" t-.\" Automatically generated by Pandoc 2.11.3+.\" Automatically generated by Pandoc 2.11.3.1 .\"-.TH "Pandoc User\[cq]s Guide" "" "December 17, 2020" "pandoc 2.11.3.1" ""+.TH "Pandoc User\[cq]s Guide" "" "December 29, 2020" "pandoc 2.11.3.2" "" .hy .SH NAME pandoc - general markup converter@@ -5166,8 +5166,9 @@ .PP whereas \f[C]Markdown.pl\f[R] will preserve it as is. .PP-There is one exception to this rule: text between \f[C]<script>\f[R] and-\f[C]<style>\f[R] tags is not interpreted as Markdown.+There is one exception to this rule: text between \f[C]<script>\f[R],+\f[C]<style>\f[R], and \f[C]<textarea>\f[R] tags is not interpreted as+Markdown. .PP This departure from standard Markdown should make it easier to mix Markdown with HTML block elements.
pandoc.cabal view
@@ -1,6 +1,6 @@ cabal-version:   2.2 name:            pandoc-version:         2.11.3.1+version:         2.11.3.2 build-type:      Simple license:         GPL-2.0-or-later license-file:    COPYING.md@@ -299,6 +299,7 @@                  test/tables.xwiki                  test/tables/*.html4                  test/tables/*.html5+                 test/tables/*.latex                  test/tables/*.native                  test/tables/*.jats_archiving                  test/testsuite.txt@@ -404,7 +405,7 @@                  blaze-markup          >= 0.8      && < 0.9,                  bytestring            >= 0.9      && < 0.12,                  case-insensitive      >= 1.2      && < 1.3,-                 citeproc              >= 0.3.0.1  && < 0.4,+                 citeproc              >= 0.3.0.3  && < 0.4,                  commonmark            >= 0.1.1.2  && < 0.2,                  commonmark-extensions >= 0.2.0.4  && < 0.3,                  commonmark-pandoc     >= 0.2      && < 0.3,@@ -443,7 +444,7 @@                  syb                   >= 0.1      && < 0.8,                  tagsoup               >= 0.14.6   && < 0.15,                  temporary             >= 1.1      && < 1.4,-                 texmath               >= 0.12.0.2 && < 0.13,+                 texmath               >= 0.12.1   && < 0.13,                  text                  >= 1.1.1.0  && < 1.3,                  text-conversions      >= 0.3      && < 0.4,                  time                  >= 1.5      && < 1.10,
src/Text/Pandoc/Citeproc.hs view
@@ -507,7 +507,9 @@                       x'' = if "://" `T.isInfixOf` x'                                then x'                                else pref <> x'-                  in  FancyVal (B.link x'' "" (B.str x'))+                  in  if T.null x'+                         then x+                         else FancyVal (B.link x'' "" (B.str x'))  extractText :: Val Inlines -> Text extractText (TextVal x)  = x
src/Text/Pandoc/Readers/HTML.hs view
@@ -61,8 +61,9 @@     ReaderOptions (readerExtensions, readerStripComments),     extensionEnabled) import Text.Pandoc.Parsing hiding ((<|>))-import Text.Pandoc.Shared (addMetaField, blocksToInlines', crFilter, escapeURI,-                           extractSpaces, htmlSpanLikeElements, safeRead, tshow)+import Text.Pandoc.Shared (+    addMetaField, blocksToInlines', crFilter, escapeURI, extractSpaces,+    htmlSpanLikeElements, renderTags', safeRead, tshow) import Text.Pandoc.Walk import Text.Parsec.Error import Text.TeXMath (readMathML, writeTeX)@@ -1045,26 +1046,3 @@   return $ case (parseURIReference (T.unpack url), mbBaseHref) of                 (Just rel, Just bs) -> tshow (rel `nonStrictRelativeTo` bs)                 _                   -> url---- For now we need a special version here; the one in Shared has String type-renderTags' :: [Tag Text] -> Text-renderTags' = renderTagsOptions-               renderOptions{ optMinimize = matchTags ["hr", "br", "img",-                                                       "meta", "link"]-                            , optRawTag   = matchTags ["script", "style"] }-              where matchTags tags = flip elem tags . T.toLower----- EPUB Specific-------{---types :: [(String, ([String], Int))]-types =  -- Document divisions-   map (\s -> (s, (["section", "body"], 0)))-    ["volume", "part", "chapter", "division"]-  <> -- Document section and components-  [-    ("abstract",  ([], 0))]--}
src/Text/Pandoc/Writers/AnnotatedTable.hs view
@@ -1,8 +1,12 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TupleSections #-}+{-# LANGUAGE UndecidableInstances #-}  {- |    Module      : Text.Pandoc.Writers.AnnotatedTable@@ -45,6 +49,7 @@ import           Data.List.NonEmpty             ( NonEmpty(..) ) import           GHC.Generics                   ( Generic ) import qualified Text.Pandoc.Builder           as B+import           Text.Pandoc.Walk               ( Walkable (..) )  -- | An annotated table type, corresponding to the Pandoc 'B.Table' -- constructor and the HTML @\<table\>@ element. It records the data@@ -298,3 +303,21 @@  fromCell :: Cell -> B.Cell fromCell (Cell _ _ c) = c++--+-- Instances+--+instance Walkable a B.Cell => Walkable a Cell where+  walkM f (Cell colspecs colnum cell) =+    Cell colspecs colnum <$> walkM f cell+  query f (Cell _colspecs _colnum cell) = query f cell++instance Walkable a B.Cell => Walkable a HeaderRow where+  walkM f (HeaderRow attr rownum cells) =+    HeaderRow attr rownum <$> walkM f cells+  query f (HeaderRow _attr _rownum cells) = query f cells++instance Walkable a B.Cell => Walkable a TableHead where+  walkM f (TableHead attr rows) =+    TableHead attr <$> walkM f rows+  query f (TableHead _attr rows) = query f rows
src/Text/Pandoc/Writers/AsciiDoc.hs view
@@ -37,6 +37,7 @@ import Text.Pandoc.Templates (renderTemplate) import Text.Pandoc.Writers.Shared + data WriterState = WriterState { defListMarker       :: Text                                , orderedListLevel    :: Int                                , bulletListLevel     :: Int@@ -45,6 +46,10 @@                                , asciidoctorVariant  :: Bool                                , inList              :: Bool                                , hasMath             :: Bool+                               -- |0 is no table+                               -- 1 is top level table+                               -- 2 is a table in a table+                               , tableNestingLevel   :: Int                                }  defaultWriterState :: WriterState@@ -56,6 +61,7 @@                                  , asciidoctorVariant = False                                  , inList             = False                                  , hasMath            = False+                                 , tableNestingLevel  = 0                                  }  -- | Convert Pandoc to AsciiDoc.@@ -194,7 +200,7 @@                      else contents   let bar = text "____"   return $ bar $$ chomp contents' $$ bar <> blankline-blockToAsciiDoc opts (Table _ blkCapt specs thead tbody tfoot) = do+blockToAsciiDoc opts block@(Table _ blkCapt specs thead tbody tfoot) = do   let (caption, aligns, widths, headers, rows) =         toLegacyTable blkCapt specs thead tbody tfoot   caption' <- inlineListToAsciiDoc opts caption@@ -236,23 +242,42 @@              $ zipWith colspec aligns widths')          <> text ","          <> headerspec <> text "]"+         +  -- construct cells and recurse in case of nested tables+  parentTableLevel <- gets tableNestingLevel+  let currentNestingLevel = parentTableLevel + 1+  +  modify $ \st -> st{ tableNestingLevel = currentNestingLevel }+  +  let separator = text (if parentTableLevel == 0+                          then "|"  -- top level separator+                          else "!") -- nested separator+   let makeCell [Plain x] = do d <- blockListToAsciiDoc opts [Plain x]-                              return $ text "|" <> chomp d+                              return $ separator <> chomp d       makeCell [Para x]  = makeCell [Plain x]-      makeCell []        = return $ text "|"-      makeCell bs        = do d <- blockListToAsciiDoc opts bs-                              return $ text "a|" $$ d+      makeCell []        = return separator+      makeCell bs        = if currentNestingLevel == 2+                             then do+                               --asciidoc only supports nesting once+                               report $ BlockNotRendered block+                               return separator+                             else do+                               d <- blockListToAsciiDoc opts bs+                               return $ (text "a" <> separator) $$ d+   let makeRow cells = hsep `fmap` mapM makeCell cells   rows' <- mapM makeRow rows   head' <- makeRow headers+  modify $ \st -> st{ tableNestingLevel = parentTableLevel }   let head'' = if all null headers then empty else head'   let colwidth = if writerWrapText opts == WrapAuto                     then writerColumns opts                     else 100000   let maxwidth = maximum $ map offset (head':rows')   let body = if maxwidth > colwidth then vsep rows' else vcat rows'-  let border = text "|==="-  return $+  let border = separator <> text "==="+  return $      caption'' $$ tablespec $$ border $$ head'' $$ body $$ border $$ blankline blockToAsciiDoc opts (BulletList items) = do   inlist <- gets inList
src/Text/Pandoc/Writers/Docx.hs view
@@ -1011,12 +1011,16 @@                       $ blockToOpenXML opts (Para caption)   let alignmentFor al = mknode "w:jc" [("w:val",alignmentToString al)] ()   -- Table cells require a <w:p> element, even an empty one!-  -- Not in the spec but in Word 2007, 2010. See #4953.+  -- Not in the spec but in Word 2007, 2010. See #4953. And+  -- apparently the last element must be a <w:p>, see #6983.   let cellToOpenXML (al, cell) = do         es <- withParaProp (alignmentFor al) $ blocksToOpenXML opts cell-        return $ if any (\e -> qName (elName e) == "p") (onlyElems es)-           then es-           else es ++ [Elem $ mknode "w:p" [] ()]+        return $+          case reverse (onlyElems es) of+            b:e:_ | qName (elName b) == "bookmarkEnd"+                  , qName (elName e) == "p" -> es+            e:_   | qName (elName e) == "p" -> es+            _ -> es ++ [Elem $ mknode "w:p" [] ()]   headers' <- mapM cellToOpenXML $ zip aligns headers   rows' <- mapM (mapM cellToOpenXML . zip aligns) rows   let borderProps = Elem $ mknode "w:tcPr" []
src/Text/Pandoc/Writers/HTML.hs view
@@ -254,6 +254,8 @@   let stringifyHTML = escapeStringForXML . stringify   let authsMeta = map stringifyHTML $ docAuthors meta   let dateMeta  = stringifyHTML $ docDate meta+  let descriptionMeta = escapeStringForXML $+                          lookupMetaString "description" meta   slideVariant <- gets stSlideVariant   let sects = adjustNumbers opts $               makeSections (writerNumberSections opts) Nothing $@@ -352,6 +354,7 @@                   defField "author-meta" authsMeta .                   maybe id (defField "date-meta")                     (normalizeDate dateMeta) .+                  defField "description-meta" descriptionMeta .                   defField "pagetitle"                       (stringifyHTML . docTitle $ meta) .                   defField "idprefix" (writerIdentifierPrefix opts) .@@ -778,12 +781,17 @@       classes' = case slideVariant of         NoSlides -> classes         _ -> filter (\k -> k /= "incremental" && k /= "nonincremental") classes+  let paraToPlain (Para ils) = Plain ils+      paraToPlain x          = x+  let bs' = if "csl-entry" `elem` classes'+               then walk paraToPlain bs+               else bs   contents <- if "columns" `elem` classes'                  then -- we don't use blockListToHtml because it inserts                       -- a newline between the column divs, which throws                       -- off widths! see #4028-                      mconcat <$> mapM (blockToHtml opts) bs-                 else blockListToHtml opts' bs+                      mconcat <$> mapM (blockToHtml opts) bs'+                 else blockListToHtml opts' bs'   let contents' = nl opts >> contents >> nl opts   let (divtag, classes'') = if html5 && "section" `elem` classes'                             then (H5.section, filter (/= "section") classes')
src/Text/Pandoc/Writers/LaTeX.hs view
@@ -48,6 +48,7 @@ import Text.Pandoc.Writers.Shared import Text.Printf (printf) import qualified Data.Text.Normalize as Normalize+import qualified Text.Pandoc.Writers.AnnotatedTable as Ann  -- | Convert Pandoc to LaTeX. writeLaTeX :: PandocMonad m => WriterOptions -> Pandoc -> m Text@@ -154,6 +155,7 @@                   defField "documentclass" documentClass $                   defField "verbatim-in-note" (stVerbInNote st) $                   defField "tables" (stTable st) $+                  defField "multirow" (stMultiRow st) $                   defField "strikeout" (stStrikeout st) $                   defField "url" (stUrl st) $                   defField "numbersections" (writerNumberSections options) $@@ -716,9 +718,9 @@   hdr <- sectionHeader classes id' level lst   modify $ \s -> s{stInHeading = False}   return hdr-blockToLaTeX (Table _ blkCapt specs thead tbodies tfoot) =+blockToLaTeX (Table attr blkCapt specs thead tbodies tfoot) =   tableToLaTeX inlineListToLaTeX blockListToLaTeX-               blkCapt specs thead tbodies tfoot+               (Ann.toTable attr blkCapt specs thead tbodies tfoot)  blockListToLaTeX :: PandocMonad m => [Block] -> LW m (Doc Text) blockListToLaTeX lst =
src/Text/Pandoc/Writers/LaTeX/Table.hs view
@@ -16,6 +16,7 @@   ) where import Control.Monad.State.Strict import Data.List (intersperse)+import Data.List.NonEmpty (NonEmpty ((:|))) import Data.Text (Text) import qualified Data.Text as T import Text.Pandoc.Class.PandocMonad (PandocMonad)@@ -23,103 +24,197 @@ import Text.DocLayout   ( Doc, braces, cr, empty, hcat, hsep, isEmpty, literal, nest   , text, vcat, ($$) )-import Text.Pandoc.Shared (splitBy)+import Text.Pandoc.Shared (blocksToInlines, splitBy, tshow) import Text.Pandoc.Walk (walk)-import Text.Pandoc.Writers.Shared (toLegacyTable) import Text.Pandoc.Writers.LaTeX.Caption (getCaption) import Text.Pandoc.Writers.LaTeX.Notes (notesToLaTeX) import Text.Pandoc.Writers.LaTeX.Types-  ( LW, WriterState (stBeamer, stExternalNotes, stInMinipage, stNotes, stTable) )+  ( LW, WriterState (stBeamer, stExternalNotes, stInMinipage, stMultiRow+                    , stNotes, stTable) ) import Text.Printf (printf)+import qualified Text.Pandoc.Builder as B+import qualified Text.Pandoc.Writers.AnnotatedTable as Ann  tableToLaTeX :: PandocMonad m              => ([Inline] -> LW m (Doc Text))              -> ([Block]  -> LW m (Doc Text))-             -> Caption -> [ColSpec] -> TableHead -> [TableBody] -> TableFoot+             -> Ann.Table              -> LW m (Doc Text)-tableToLaTeX inlnsToLaTeX blksToLaTeX blkCapt specs thead tbody tfoot = do-  let (caption, aligns, widths, heads, rows) =-        toLegacyTable blkCapt specs thead tbody tfoot-  -- simple tables have to have simple cells:-  let isSimple = \case-        [Plain _] -> True-        [Para  _] -> True-        []        -> True-        _         -> False-  let widths' = if all (== 0) widths && not (all (all isSimple) rows)-                   then replicate (length aligns)-                          (1 / fromIntegral (length aligns))-                   else widths-  (captionText, captForLof, captNotes) <- getCaption inlnsToLaTeX False caption-  let toHeaders hs = do contents <- tableRowToLaTeX blksToLaTeX True aligns hs-                        return ("\\toprule" $$ contents $$ "\\midrule")+tableToLaTeX inlnsToLaTeX blksToLaTeX tbl = do+  let (Ann.Table _attr caption _specs thead tbodies tfoot) = tbl+  CaptionDocs capt captNotes <- captionToLaTeX inlnsToLaTeX caption   let removeNote (Note _) = Span ("", [], []) []       removeNote x        = x-  firsthead <- if isEmpty captionText || all null heads-                  then return empty-                  else ($$ text "\\endfirsthead") <$> toHeaders heads-  head' <- if all null heads-              then return "\\toprule"-              -- avoid duplicate notes in head and firsthead:-              else toHeaders (if isEmpty firsthead-                                 then heads-                                 else walk removeNote heads)-  let capt = if isEmpty captionText-                then empty-                else "\\caption" <> captForLof <> braces captionText-                         <> "\\tabularnewline"-  rows' <- mapM (tableRowToLaTeX blksToLaTeX False aligns) rows-  let colDescriptors =-         (if all (== 0) widths'-             then hcat . map literal-             else (\xs -> cr <> nest 2 (vcat $ map literal xs))) $-         zipWith (toColDescriptor (length widths')) aligns widths'+  firsthead <- if isEmpty capt || isEmptyHead thead+               then return empty+               else ($$ text "\\endfirsthead") <$>+                    headToLaTeX blksToLaTeX thead+  head' <- if isEmptyHead thead+           then return "\\toprule"+           -- avoid duplicate notes in head and firsthead:+           else headToLaTeX blksToLaTeX+                (if isEmpty firsthead+                 then thead+                 else walk removeNote thead)+  rows' <- mapM (rowToLaTeX blksToLaTeX BodyCell) $+                mconcat (map bodyRows tbodies) <> footRows tfoot   modify $ \s -> s{ stTable = True }   notes <- notesToLaTeX <$> gets stNotes-  return $ "\\begin{longtable}[]" <>-              braces ("@{}" <> colDescriptors <> "@{}")-              -- the @{} removes extra space at beginning and end-         $$ capt-         $$ firsthead-         $$ head'-         $$ "\\endhead"-         $$ vcat rows'-         $$ "\\bottomrule"-         $$ "\\end{longtable}"-         $$ captNotes-         $$ notes+  return+    $  "\\begin{longtable}[]" <>+          braces ("@{}" <> colDescriptors tbl <> "@{}")+          -- the @{} removes extra space at beginning and end+    $$ capt+    $$ firsthead+    $$ head'+    $$ "\\endhead"+    $$ vcat rows'+    $$ "\\bottomrule"+    $$ "\\end{longtable}"+    $$ captNotes+    $$ notes -toColDescriptor :: Int -> Alignment -> Double -> Text-toColDescriptor _numcols align 0 =-  case align of-         AlignLeft    -> "l"-         AlignRight   -> "r"-         AlignCenter  -> "c"-         AlignDefault -> "l"-toColDescriptor numcols align width =-  T.pack $ printf-     ">{%s\\arraybackslash}p{(\\columnwidth - %d\\tabcolsep) * \\real{%0.2f}}"-     align'-     ((numcols - 1) * 2)-     width- where-   align' :: String-   align' = case align of-              AlignLeft    -> "\\raggedright"-              AlignRight   -> "\\raggedleft"-              AlignCenter  -> "\\centering"-              AlignDefault -> "\\raggedright"+-- | Creates column descriptors for the table.+colDescriptors :: Ann.Table -> Doc Text+colDescriptors (Ann.Table _attr _caption specs thead tbodies tfoot) =+  let (aligns, widths) = unzip specs -tableRowToLaTeX :: PandocMonad m-                => ([Block] -> LW m (Doc Text))-                -> Bool-                -> [Alignment]-                -> [[Block]]-                -> LW m (Doc Text)-tableRowToLaTeX blockListToLaTeX header aligns cols = do-  cells <- mapM (tableCellToLaTeX blockListToLaTeX header) $ zip aligns cols-  return $ hsep (intersperse "&" cells) <> " \\\\ \\addlinespace"+      defaultWidthsOnly = all (== ColWidthDefault) widths+      isSimpleTable = all (all isSimpleCell) $ mconcat+                      [ headRows thead+                      , concatMap bodyRows tbodies+                      , footRows tfoot+                      ] +      relativeWidths = if defaultWidthsOnly+                       then replicate (length specs)+                            (1 / fromIntegral (length specs))+                       else map toRelWidth widths+  in if defaultWidthsOnly && isSimpleTable+     then hcat $ map (literal . colAlign) aligns+     else (cr <>) . nest 2 . vcat . map literal $+          zipWith (toColDescriptor (length specs))+                  aligns+                  relativeWidths+  where+    toColDescriptor :: Int -> Alignment -> Double -> Text+    toColDescriptor numcols align width =+      T.pack $ printf+      ">{%s\\arraybackslash}p{(\\columnwidth - %d\\tabcolsep) * \\real{%0.2f}}"+      (T.unpack (alignCommand align))+      ((numcols - 1) * 2)+      width++    isSimpleCell (Ann.Cell _ _ (Cell _attr _align _rowspan _colspan blocks)) =+      case blocks of+        [Para _]  -> True+        [Plain _] -> True+        []        -> True+        _         -> False++    toRelWidth ColWidthDefault = 0+    toRelWidth (ColWidth w)    = w++alignCommand :: Alignment -> Text+alignCommand = \case+  AlignLeft    -> "\\raggedright"+  AlignRight   -> "\\raggedleft"+  AlignCenter  -> "\\centering"+  AlignDefault -> "\\raggedright"++colAlign :: Alignment -> Text+colAlign = \case+  AlignLeft    -> "l"+  AlignRight   -> "r"+  AlignCenter  -> "c"+  AlignDefault -> "l"++data CaptionDocs =+  CaptionDocs+  { captionCommand :: Doc Text+  , captionNotes :: Doc Text+  }++captionToLaTeX :: PandocMonad m+               => ([Inline] -> LW m (Doc Text))+               -> Caption+               -> LW m CaptionDocs+captionToLaTeX inlnsToLaTeX (Caption _maybeShort longCaption) = do+  let caption = blocksToInlines longCaption+  (captionText, captForLof, captNotes) <- getCaption inlnsToLaTeX False caption+  return $ CaptionDocs+    { captionNotes = captNotes+    , captionCommand = if isEmpty captionText+                       then empty+                       else "\\caption" <> captForLof <>+                            braces captionText <> "\\tabularnewline"+    }++type BlocksWriter m = [Block] -> LW m (Doc Text)++headToLaTeX :: PandocMonad m+            => BlocksWriter m+            -> Ann.TableHead+            -> LW m (Doc Text)+headToLaTeX blocksWriter (Ann.TableHead _attr headerRows) = do+  rowsContents <- mapM (rowToLaTeX blocksWriter HeaderCell . headerRowCells)+                       headerRows+  return ("\\toprule" $$ vcat rowsContents $$ "\\midrule")++-- | Converts a row of table cells into a LaTeX row.+rowToLaTeX :: PandocMonad m+           => BlocksWriter m+           -> CellType+           -> [Ann.Cell]+           -> LW m (Doc Text)+rowToLaTeX blocksWriter celltype row = do+  cellsDocs <- mapM (cellToLaTeX blocksWriter celltype) (fillRow row)+  return $ hsep (intersperse "&" cellsDocs) <> " \\\\ \\addlinespace"++-- | Pads row with empty cells to adjust for rowspans above this row.+fillRow :: [Ann.Cell] -> [Ann.Cell]+fillRow = go 0+  where+    go _ [] = []+    go n (acell@(Ann.Cell _spec (Ann.ColNumber colnum) cell):cells) =+      let (Cell _ _ _ (ColSpan colspan) _) = cell+      in map mkEmptyCell [n .. colnum - 1] +++         acell : go (colnum + colspan) cells++    mkEmptyCell :: Int -> Ann.Cell+    mkEmptyCell colnum =+      Ann.Cell ((AlignDefault, ColWidthDefault):|[])+               (Ann.ColNumber colnum)+               B.emptyCell++isEmptyHead :: Ann.TableHead -> Bool+isEmptyHead (Ann.TableHead _attr []) = True+isEmptyHead (Ann.TableHead _attr rows) = all (null . headerRowCells) rows++-- | Gets all cells in a header row.+headerRowCells :: Ann.HeaderRow -> [Ann.Cell]+headerRowCells (Ann.HeaderRow _attr _rownum cells) = cells++-- | Gets all cells in a body row.+bodyRowCells :: Ann.BodyRow -> [Ann.Cell]+bodyRowCells (Ann.BodyRow _attr _rownum rowhead cells) = rowhead <> cells++-- | Gets a list of rows of the table body, where a row is a simple+-- list of cells.+bodyRows :: Ann.TableBody -> [[Ann.Cell]]+bodyRows (Ann.TableBody _attr _rowheads headerRows rows) =+  map headerRowCells headerRows <> map bodyRowCells rows++-- | Gets a list of rows of the table head, where a row is a simple+-- list of cells.+headRows :: Ann.TableHead -> [[Ann.Cell]]+headRows (Ann.TableHead _attr rows) = map headerRowCells rows++-- | Gets a list of rows from the foot, where a row is a simple list+-- of cells.+footRows :: Ann.TableFoot -> [[Ann.Cell]]+footRows (Ann.TableFoot _attr rows) = map headerRowCells rows+ -- For simple latex tables (without minipages or parboxes), -- we need to go to some lengths to get line breaks working: -- as LineBreak bs = \vtop{\hbox{\strut as}\hbox{\strut bs}}.@@ -144,11 +239,14 @@ displayMathToInline (Math DisplayMath x) = Math InlineMath x displayMathToInline x                    = x -tableCellToLaTeX :: PandocMonad m-                 => ([Block] -> LW m (Doc Text))-                 -> Bool -> (Alignment, [Block])-                 -> LW m (Doc Text)-tableCellToLaTeX blockListToLaTeX header (align, blocks) = do+cellToLaTeX :: PandocMonad m+            => BlocksWriter m+            -> CellType+            -> Ann.Cell+            -> LW m (Doc Text)+cellToLaTeX blockListToLaTeX celltype annotatedCell = do+  let (Ann.Cell _specs _colnum cell) = annotatedCell+  let (Cell _attr align rowspan colspan blocks) = cell   beamer <- gets stBeamer   externalNotes <- gets stExternalNotes   inMinipage <- gets stInMinipage@@ -167,15 +265,30 @@          modify $ \st -> st{ stInMinipage = True }          cellContents <- blockListToLaTeX blocks          modify $ \st -> st{ stInMinipage = inMinipage }-         let valign = text $ if header then "[b]" else "[t]"-         let halign = case align of-                        AlignLeft    -> "\\raggedright"-                        AlignRight   -> "\\raggedleft"-                        AlignCenter  -> "\\centering"-                        AlignDefault -> "\\raggedright"+         let valign = text $ case celltype of+                               HeaderCell -> "[b]"+                               BodyCell   -> "[t]"+         let halign = literal $ alignCommand align          return $ "\\begin{minipage}" <> valign <>                   braces "\\linewidth" <> halign <> cr <>                   cellContents <> cr <>                   "\\end{minipage}"   modify $ \st -> st{ stExternalNotes = externalNotes }-  return result+  when (rowspan /= RowSpan 1) $+    modify (\st -> st{ stMultiRow = True })+  let inMultiColumn x = case colspan of+                          (ColSpan 1) -> x+                          (ColSpan n) -> "\\multicolumn"+                                         <> braces (literal (tshow n))+                                         <> braces (literal $ colAlign align)+                                         <> braces x+  let inMultiRow x = case rowspan of+                       (RowSpan 1) -> x+                       (RowSpan n) -> let nrows = literal (tshow n)+                                      in "\\multirow" <> braces nrows+                                         <> braces "*" <> braces x+  return . inMultiColumn . inMultiRow $ result++data CellType+  = HeaderCell+  | BodyCell
src/Text/Pandoc/Writers/LaTeX/Types.hs view
@@ -31,6 +31,7 @@                                      --   be parameter   , stVerbInNote    :: Bool          -- ^ true if document has verbatim text in note   , stTable         :: Bool          -- ^ true if document has a table+  , stMultiRow      :: Bool          -- ^ true if document has multirow cells   , stStrikeout     :: Bool          -- ^ true if document has strikeout   , stUrl           :: Bool          -- ^ true if document has visible URL link   , stGraphics      :: Bool          -- ^ true if document contains images@@ -61,6 +62,7 @@   , stOptions = options   , stVerbInNote = False   , stTable = False+  , stMultiRow = False   , stStrikeout = False   , stUrl = False   , stGraphics = False
src/Text/Pandoc/Writers/Powerpoint/Output.hs view
@@ -437,10 +437,10 @@ getContentShapeSize _ _ _ = throwError $ PandocSomeError                             "Attempted to find content shape size in non-layout" -buildSpTree :: NameSpaces -> Element -> [Element] -> Element+buildSpTree :: NameSpaces -> Element -> [Content] -> Element buildSpTree ns spTreeElem newShapes =   emptySpTreeElem { elContent = newContent }-  where newContent = elContent emptySpTreeElem <> map Elem newShapes+  where newContent = elContent emptySpTreeElem <> newShapes         emptySpTreeElem = spTreeElem { elContent = filter fn (elContent spTreeElem) }         fn :: Content -> Bool         fn (Elem e) = isElem ns "p" "nvGrpSpPr" e ||@@ -744,8 +744,8 @@     else return [picShape]  -paraElemToElements :: PandocMonad m => ParaElem -> P m [Element]-paraElemToElements Break = return [mknode "a:br" [] ()]+paraElemToElements :: PandocMonad m => ParaElem -> P m [Content]+paraElemToElements Break = return [Elem $ mknode "a:br" [] ()] paraElemToElements (Run rpr s) = do   sizeAttrs <- fontSizeAttributes rpr   let attrs = sizeAttrs <>@@ -801,19 +801,20 @@   let codeContents =         [mknode "a:latin" [("typeface", T.unpack codeFont)] () | rPropCode rpr]   let propContents = linkProps <> colorContents <> codeContents-  return [mknode "a:r" [] [ mknode "a:rPr" attrs propContents-                          , mknode "a:t" [] $ T.unpack s-                          ]]+  return [Elem $ mknode "a:r" [] [ mknode "a:rPr" attrs propContents+                                 , mknode "a:t" [] $ T.unpack s+                                 ]] paraElemToElements (MathElem mathType texStr) = do   isInSpkrNotes <- asks envInSpeakerNotes   if isInSpkrNotes     then paraElemToElements $ Run def $ unTeXString texStr     else do res <- convertMath writeOMML mathType (unTeXString texStr)             case res of-              Right r -> return [mknode "a14:m" [] $ addMathInfo r]+              Right r -> return [Elem $ mknode "a14:m" [] $ addMathInfo r]               Left (Str s) -> paraElemToElements (Run def s)               Left _       -> throwError $ PandocShouldNeverHappenError "non-string math fallback"-paraElemToElements (RawOOXMLParaElem str) = return [ x | Elem x <- parseXML str ]+paraElemToElements (RawOOXMLParaElem str) = return+  [Text (CData CDataRaw (T.unpack str) Nothing)]   -- This is a bit of a kludge -- really requires adding an option to@@ -875,8 +876,9 @@                  [mknode "a:buAutoNum" (autoNumAttrs attrs') ()]                Nothing -> [mknode "a:buNone" [] ()]             )-  paras <- concat <$> mapM paraElemToElements (paraElems par)-  return $ mknode "a:p" [] $ [mknode "a:pPr" attrs props] <> paras+  paras <- mapM paraElemToElements (paraElems par)+  return $ mknode "a:p" [] $+    [Elem $ mknode "a:pPr" attrs props] <> concat paras  shapeToElement :: PandocMonad m => Element -> Shape -> P m Element shapeToElement layout (TextBox paras)@@ -896,21 +898,22 @@ -- GraphicFrame and Pic should never reach this. shapeToElement _ _ = return $ mknode "p:sp" [] () -shapeToElements :: PandocMonad m => Element -> Shape -> P m [Element]+shapeToElements :: PandocMonad m => Element -> Shape -> P m [Content] shapeToElements layout (Pic picProps fp alt) = do   mInfo <- registerMedia fp alt   case mInfoExt mInfo of-    Just _ ->+    Just _ -> map Elem <$>       makePicElements layout picProps mInfo alt     Nothing -> shapeToElements layout $ TextBox [Paragraph def alt]-shapeToElements layout (GraphicFrame tbls cptn) =+shapeToElements layout (GraphicFrame tbls cptn) = map Elem <$>   graphicFrameToElements layout tbls cptn-shapeToElements _ (RawOOXMLShape str) = return [ x | Elem x <- parseXML str ]+shapeToElements _ (RawOOXMLShape str) = return+  [Text (CData CDataRaw (T.unpack str) Nothing)] shapeToElements layout shp = do   element <- shapeToElement layout shp-  return [element]+  return [Elem element] -shapesToElements :: PandocMonad m => Element -> [Shape] -> P m [Element]+shapesToElements :: PandocMonad m => Element -> [Shape] -> P m [Content] shapesToElements layout shps =  concat <$> mapM (shapeToElements layout) shps @@ -1083,7 +1086,7 @@   , Just cSld <- findChild (elemName ns "p" "cSld") layout   , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do       element <- nonBodyTextToElement layout [PHType "title"] hdrShape-      let hdrShapeElements = [element | not (null hdrShape)]+      let hdrShapeElements = [Elem element | not (null hdrShape)]       contentElements <- local                          (\env -> env {envContentType = NormalContent})                          (shapesToElements layout shapes)@@ -1096,7 +1099,7 @@   , Just cSld <- findChild (elemName ns "p" "cSld") layout   , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do       element <- nonBodyTextToElement layout [PHType "title"] hdrShape-      let hdrShapeElements = [element | not (null hdrShape)]+      let hdrShapeElements = [Elem element | not (null hdrShape)]       contentElementsL <- local                           (\env -> env {envContentType =TwoColumnLeftContent})                           (shapesToElements layout shapesL)@@ -1105,7 +1108,8 @@                           (shapesToElements layout shapesR)       -- let contentElementsL' = map (setIdx ns "1") contentElementsL       --     contentElementsR' = map (setIdx ns "2") contentElementsR-      return $ buildSpTree ns spTree (hdrShapeElements <> contentElementsL <> contentElementsR)+      return $ buildSpTree ns spTree $+        hdrShapeElements <> contentElementsL <> contentElementsR twoColumnToElement _ _ _ _= return $ mknode "p:sp" [] ()  @@ -1115,7 +1119,7 @@   , Just cSld <- findChild (elemName ns "p" "cSld") layout   , Just spTree <- findChild (elemName ns "p" "spTree") cSld = do       element <- nonBodyTextToElement layout [PHType "title", PHType "ctrTitle"] titleElems-      let titleShapeElements = [element | not (null titleElems)]+      let titleShapeElements = [Elem element | not (null titleElems)]       return $ buildSpTree ns spTree titleShapeElements titleToElement _ _ = return $ mknode "p:sp" [] () @@ -1135,7 +1139,8 @@       dateShapeElements <- if null dateElems                            then return []                            else sequence [nonBodyTextToElement layout [PHType "dt"] dateElems]-      return $ buildSpTree ns spTree (titleShapeElements <> subtitleShapeElements <> dateShapeElements)+      return . buildSpTree ns spTree . map Elem $+        (titleShapeElements <> subtitleShapeElements <> dateShapeElements) metadataToElement _ _ _ _ _ = return $ mknode "p:sp" [] ()  slideToElement :: PandocMonad m => Slide -> P m Element
stack.yaml view
@@ -17,7 +17,8 @@ - commonmark-extensions-0.2.0.4 - commonmark-pandoc-0.2.0.1 - doctemplates-0.9-- citeproc-0.3.0.1+- citeproc-0.3.0.3+- texmath-0.12.1 # - citeproc: #   git: https://github.com/jgm/citeproc.git #   commit: a8193fe375fa2354049bf9a967ba3bad4b1ba053
test/Tests/Old.hs view
@@ -58,7 +58,7 @@     ]   , testGroup "latex"     [ testGroup "writer"-        (writerTests' "latex" ++ lhsWriterTests' "latex")+        (extWriterTests' "latex" ++ lhsWriterTests' "latex")     , testGroup "reader"       [ test' "basic" ["-r", "latex+raw_tex", "-w", "native", "-s"]         "latex-reader.latex" "latex-reader.native"
+ test/command/nested-table-to-asciidoc-6942.md view
@@ -0,0 +1,82 @@+A table within a table should be convertet into a table within table++```+% pandoc -f html -t asciidoc+<!doctype html>+<html>+<head>+<meta charset="utf-8">+<title> NestedTables </title>+</head>+<body>+<table>+ <tr>+  <td >+   <table>  <tr> <td> a1 </td> <td> a2 </td> </tr>  </table>+  </td>+  <td>b</td>+ </tr>+ <tr>+   <td>c</td> <td>d </td>+ </tr>+</table>+</body>+</html>+^D+[width="100%",cols="50%,50%",]+|===+a|+[cols=",",]+!===+!a1 !a2+!===++|b+|c |d+|===+```++A table within a table within a table cannot be converted because asciidoc only+supports two levels of tables.+The table on level 3 is thus converted to level 2 and a warning is produced+```+% pandoc -f html -t asciidoc --verbose+<!doctype html>+<html>+<head>+<meta charset="utf-8">+<title> NestedTables </title>+</head>+<body>+<table>+ <tr>+  <td>+    <table>  <tr>+	<td> a1 </td>+	<td>+	  <table>  <tr> <td> 1 </td> <td> 2 </td> </tr>  </table>+	</td>+    </tr>  </table>+  </td>+  <td>b</td>+ </tr>+ <tr>+   <td>c</td> <td>d </td>+ </tr>+</table>+</body>+</html>+^D+[INFO] Not rendering Table ("",[],[]) (Caption Nothing []) [(AlignDefault,ColWidth 0.5),(AlignDefault,ColWidth 0.5)] (TableHead ("",[],[]) []) [TableBody ("",[],[]) (RowHeadColumns 0) [] [Row ("",[],[]) [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "a1"]],Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Table ("",[],[]) (Caption Nothing []) [(AlignDefault,ColWidthDefault),(AlignDefault,ColWidthDefault)] (TableHead ("",[],[]) []) [TableBody ("",[],[]) (RowHeadColumns 0) [] [Row ("",[],[]) [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "1"]],Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "2"]]]]] (TableFoot ("",[],[]) [])]]]] (TableFoot ("",[],[]) [])+[width="100%",cols="50%,50%",]+|===+a|+[width="100%",cols="50%,50%",]+!===+!a1 !+!===++|b+|c |d+|===+```
test/command/pandoc-citeproc-chicago-author-date.md view
@@ -60,7 +60,7 @@  [Doe](#ref-item1) ([2005, 30](#ref-item1), with suffix) says blah. -[Doe](#ref-item1) ([2005](#ref-item1), [2006, 30](#ref-item2); see also+[Doe](#ref-item1) ([2005](#ref-item1); [2006, 30](#ref-item2); see also [Doe and Roe 2007](#ref-пункт3)) says blah.  In a note.[^1]
test/pptx/raw_ooxml.native view
@@ -1,3 +1,3 @@ [Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "text,",Space,Str "written",Space,Str "as",Space,Str "a",Space,Str "raw",Space,Str "inline:",Space,RawInline (Format "openxml") "<a:r><a:rPr /><a:t>Here are examples of </a:t></a:r><a:r><a:rPr i=\"1\" /><a:t>italics</a:t></a:r><a:r><a:rPr /><a:t>, </a:t></a:r><a:r><a:rPr b=\"1\" /><a:t>bold</a:t></a:r>"] ,HorizontalRule-,RawBlock (Format "openxml") "      <p:sp>\n        <p:nvSpPr>\n          <p:cNvPr id=\"3\" name=\"Content Placeholder 2\"/>\n          <p:cNvSpPr>\n            <a:spLocks noGrp=\"1\"/>\n          </p:cNvSpPr>\n          <p:nvPr>\n            <p:ph idx=\"1\"/>\n          </p:nvPr>\n        </p:nvSpPr>\n        <p:spPr/>\n        <p:txBody>\n          <a:bodyPr/>\n          <a:lstStyle/>\n          <a:p>\n            <a:pPr lvl=\"1\"/>\n            <a:r>\n              <a:rPr/>\n              <a:t>Bulleted bulleted lists.</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"1\"/>\n            <a:r>\n              <a:rPr/>\n              <a:t>And go to arbitrary depth.</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"2\"/>\n            <a:r>\n              <a:rPr/>\n              <a:t>Like this</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"3\"/>\n            <a:r>\n              <a:rPr/>\n              <a:t>Or this</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"2\"/>\n            <a:r>\n              <a:rPr/>\n              <a:t>Back to here.</a:t>\n            </a:r>\n          </a:p>\n        </p:txBody>\n      </p:sp>"]+,RawBlock (Format "openxml") "<p:sp>\n        <p:nvSpPr>\n          <p:cNvPr id=\"3\" name=\"Content Placeholder 2\" />\n          <p:cNvSpPr>\n            <a:spLocks noGrp=\"1\" />\n          </p:cNvSpPr>\n          <p:nvPr>\n            <p:ph idx=\"1\" />\n          </p:nvPr>\n        </p:nvSpPr>\n        <p:spPr />\n        <p:txBody>\n          <a:bodyPr />\n          <a:lstStyle />\n          <a:p>\n            <a:pPr lvl=\"1\" />\n            <a:r>\n              <a:rPr />\n              <a:t>Bulleted bulleted lists.</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"1\" />\n            <a:r>\n              <a:rPr />\n              <a:t>And go to arbitrary depth.</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"2\" />\n            <a:r>\n              <a:rPr />\n              <a:t>Like this</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"3\" />\n            <a:r>\n              <a:rPr />\n              <a:t>Or this</a:t>\n            </a:r>\n          </a:p>\n          <a:p>\n            <a:pPr lvl=\"2\" />\n            <a:r>\n              <a:rPr />\n              <a:t>Back to here.</a:t>\n            </a:r>\n          </a:p>\n        </p:txBody>\n      </p:sp>"]
+ test/tables/nordics.latex view
@@ -0,0 +1,26 @@+\begin{longtable}[]{@{}+  >{\centering\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.30}}+  >{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.30}}+  >{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.20}}+  >{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.20}}@{}}+\caption{States belonging to the \emph{Nordics.}}\tabularnewline+\toprule+Name & Capital & \vtop{\hbox{\strut Population}\hbox{\strut (in 2018)}} &+\vtop{\hbox{\strut Area}\hbox{\strut (in+km\textsuperscript{2})}} \\ \addlinespace+\midrule+\endfirsthead+\toprule+Name & Capital & \vtop{\hbox{\strut Population}\hbox{\strut (in 2018)}} &+\vtop{\hbox{\strut Area}\hbox{\strut (in+km\textsuperscript{2})}} \\ \addlinespace+\midrule+\endhead+Denmark & Copenhagen & 5,809,502 & 43,094 \\ \addlinespace+Finland & Helsinki & 5,537,364 & 338,145 \\ \addlinespace+Iceland & Reykjavik & 343,518 & 103,000 \\ \addlinespace+Norway & Oslo & 5,372,191 & 323,802 \\ \addlinespace+Sweden & Stockholm & 10,313,447 & 450,295 \\ \addlinespace+Total & & 27,376,022 & 1,258,336 \\ \addlinespace+\bottomrule+\end{longtable}
+ test/tables/planets.latex view
@@ -0,0 +1,36 @@+\begin{longtable}[]{@{}cclrrrrrrrrl@{}}+\caption{Data about the planets of our solar system.}\tabularnewline+\toprule+\multicolumn{2}{l}{} & Name & Mass (10\^{}24kg) & Diameter (km) & Density+(kg/m\^{}3) & Gravity (m/s\^{}2) & Length of day (hours) & Distance from Sun+(10\^{}6km) & Mean temperature (C) & Number of moons & Notes \\ \addlinespace+\midrule+\endfirsthead+\toprule+\multicolumn{2}{l}{} & Name & Mass (10\^{}24kg) & Diameter (km) & Density+(kg/m\^{}3) & Gravity (m/s\^{}2) & Length of day (hours) & Distance from Sun+(10\^{}6km) & Mean temperature (C) & Number of moons & Notes \\ \addlinespace+\midrule+\endhead+\multicolumn{2}{l}{\multirow{4}{*}{Terrestrial planets}} & Mercury & 0.330 &+4,879 & 5427 & 3.7 & 4222.6 & 57.9 & 167 & 0 & Closest to the+Sun \\ \addlinespace+& & Venus & 4.87 & 12,104 & 5243 & 8.9 & 2802.0 & 108.2 & 464 & 0+& \\ \addlinespace+& & Earth & 5.97 & 12,756 & 5514 & 9.8 & 24.0 & 149.6 & 15 & 1 & Our+world \\ \addlinespace+& & Mars & 0.642 & 6,792 & 3933 & 3.7 & 24.7 & 227.9 & -65 & 2 & The red+planet \\ \addlinespace+\multirow{4}{*}{Jovian planets} & \multirow{2}{*}{Gas giants} & Jupiter & 1898+& 142,984 & 1326 & 23.1 & 9.9 & 778.6 & -110 & 67 & The largest+planet \\ \addlinespace+& & Saturn & 568 & 120,536 & 687 & 9.0 & 10.7 & 1433.5 & -140 & 62+& \\ \addlinespace+& \multirow{2}{*}{Ice giants} & Uranus & 86.8 & 51,118 & 1271 & 8.7 & 17.2 &+2872.5 & -195 & 27 & \\ \addlinespace+& & Neptune & 102 & 49,528 & 1638 & 11.0 & 16.1 & 4495.1 & -200 & 14+& \\ \addlinespace+\multicolumn{2}{l}{Dwarf planets} & Pluto & 0.0146 & 2,370 & 2095 & 0.7 &+153.3 & 5906.4 & -225 & 5 & Declassified as a planet in 2006. \\ \addlinespace+\bottomrule+\end{longtable}
+ test/tables/students.latex view
@@ -0,0 +1,23 @@+\begin{longtable}[]{@{}+  >{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{0.50}}+  >{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{0.50}}@{}}+\caption{List of Students}\tabularnewline+\toprule+Student ID & Name \\ \addlinespace+\midrule+\endfirsthead+\toprule+Student ID & Name \\ \addlinespace+\midrule+\endhead+\multicolumn{2}{l}{Computer Science} \\ \addlinespace+3741255 & Jones, Martha \\ \addlinespace+4077830 & Pierce, Benjamin \\ \addlinespace+5151701 & Kirk, James \\ \addlinespace+\multicolumn{2}{l}{Russian Literature} \\ \addlinespace+3971244 & Nim, Victor \\ \addlinespace+\multicolumn{2}{l}{Astrophysics} \\ \addlinespace+4100332 & Petrov, Alexandra \\ \addlinespace+4100332 & Toyota, Hiroko \\ \addlinespace+\bottomrule+\end{longtable}