Haskell 如何在使用Pandoc生成的PDF表格中添加垂直线
有没有办法让Pandoc在不编辑Pandoc源代码的情况下在PDF输出表中放置垂直线 目前,我正在使用以下方法生成PDF:Haskell 如何在使用Pandoc生成的PDF表格中添加垂直线,haskell,pandoc,Haskell,Pandoc,有没有办法让Pandoc在不编辑Pandoc源代码的情况下在PDF输出表中放置垂直线 目前,我正在使用以下方法生成PDF: pandoc --template pandoc-template.tex -V geometry:margin=1in -V geometry:a4paper --number-sections --variable file1.md -o file1.pdf 表的降价如下所示: +-----------------+-----------------+ | Row 1
pandoc --template pandoc-template.tex -V geometry:margin=1in -V geometry:a4paper --number-sections --variable file1.md -o file1.pdf
表的降价如下所示:
+-----------------+-----------------+
| Row 1 | Some data 1 |
| Row 2 | Some data 2 |
+-----------------+-----------------+
潘多克只是忽略垂直线。我在这个话题上发现了很多问题,但答案仍然是虚幻的
为上面的标记生成的Latex可能看起来像,其中管道字符告诉Latex为表格生成垂直线:
\begin{longtable}{ | l | l |}
\hline
Row 1 & Some data 1 \\
Row 2 & Some data 2 \\
\hline
\end{longtable}
下面的代码来自LaTex.hs Pandoc源文件。我不是Haskell的开发人员,但它似乎没有添加在LaTex中创建垂直线所需的管道字符的选项
let colDescriptors = text $ concat $ map toColDescriptor aligns
modify $ \s -> s{ stTable = True }
return $ "\\begin{longtable}[c]" <>
braces ("@{}" <> colDescriptors <> "@{}")
-- the @{} removes extra space at beginning and end
$$ "\\toprule\\addlinespace"
$$ headers
$$ vcat rows'
$$ "\\bottomrule"
$$ capt
$$ "\\end{longtable}"
toColDescriptor :: Alignment -> String
toColDescriptor align =
case align of
AlignLeft -> "l"
AlignRight -> "r"
AlignCenter -> "c"
AlignDefault -> "l"
让colDescriptors=text$concat$map-to-coldescriptor对齐
修改$\s->s{stTable=True}
return$“\\begin{longtable}[c]”
大括号(“@{}”脚本“@{}”)
--@{}删除开头和结尾的额外空间
$$“\\toprule\\addlinespace”
$$标题
$$vcat行'
$$“\\bottomrule”
$$capt
$$“\\end{longtable}”
ToColdDescriptor::对齐->字符串
ToColdDescriptor对齐=
大小写对齐
左对齐->“l”
右对齐->“r”
对齐中心->“c”
对齐默认值->“l”
除了对pandoc的latex输出进行后处理外,目前没有办法添加垂直线。据此5年后,这仍然是一个问题。干得好,潘多克。