带有HTML边框的表和Pandoc标记源的LaTeX输出
这是Pandoc的降价示例表带有HTML边框的表和Pandoc标记源的LaTeX输出,html,pdf,latex,markdown,pandoc,Html,Pdf,Latex,Markdown,Pandoc,这是Pandoc的降价示例表 Simple tables look like this: Right Left Center Default ------- ------ ---------- ------- 12 12 12 12 123 123 123 123 1 1 1 1 Table:
Simple tables look like this:
Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
Table: Demonstration of simple table syntax.
不幸的是,它没有添加边界
我可能将其编码为HTML表,但在本例中,它在LaTeX中不起作用
- 如何创建一个带有边框的表,同时使用LaTeX和HTML输出
- 如果Pandoc无法完成这项工作,是否有类似的工具能够完成
table {
margin-left: auto;
margin-right: auto;
margin-bottom: 24px;
border-spacing: 0;
border-bottom: 2px solid black;
border-top: 2px solid black;
}
table th {
padding: 3px 10px;
background-color: white;
border-top: none;
border-left: none;
border-right: none;
border-bottom: 1px solid black;
}
table td {
padding: 3px 10px;
border-top: none;
border-left: none;
border-bottom: none;
border-right: none;
}
/* Add border for the last row of the table. */
/* (Might be of use for table footnotes, later). */
/* tr:last-child td { border-top: 2px solid black; } */
此CSS来自Marked.app。我相信可以在应用程序的上下载
您可以告诉Pandoc使用带有--CSS
标志的自定义CSS文件。像这样的方法应该会奏效:
pandoc -t html \
--css=/path/to/custom.css \
-o /path/to/output/file.html \
/path/to/markdown/file.md
希望能有所帮助。你可以用Pandoc来做。但这需要更多的努力 您必须利用以下事实:
技巧:在终端窗口中交互使用
pandoc
还有一个窍门
如果你不知道如何开始学习乳胶,潘多克可以教你一些。因为您可以交互使用Pandoc
对于乳胶输出:
事情是这样的:
pandoc-t latex
[返回]
[RETURN]
即可进入换行[CTRL]+[D]
$ pandoc -t latex [RETURN]
Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
Table: Demonstration of simple table syntax.
^D
老实说:我没有打降价表。
我作弊了。
我把你的问题抄下来贴在终端上。
您看到的最后一个[^D]
是当我点击[CTRL]+[D]
时
这是终端窗口中显示的内容:
\begin{longtable}[c]{@{}rlcl@{}}
\caption{Demonstration of simple table syntax.}\tabularnewline
\toprule
Right & Left & Center & Default\tabularnewline
\midrule
\endfirsthead
\toprule
Right & Left & Center & Default\tabularnewline
\midrule
\endhead
12 & 12 & 12 & 12\tabularnewline
123 & 123 & 123 & 123\tabularnewline
1 & 1 & 1 & 1\tabularnewline
\bottomrule
\end{longtable}
这是LaTeX从标记输入生成的默认LaTeX表代码
现在你可以在谷歌上搜索一些方法(如果你还不是乳胶专家的话)来拉皮条,以使桌子看起来更漂亮。繁重的工作已经完成了。(如果你是一名乳胶专家:不用自己做举重也是件好事,不是吗?)
对于HTML输出:
当然,您可以像Pandoc生成表格一样输出表格的HTML代码。看:
$ pandoc -t html [RETURN]
Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
Table: Demonstration of simple table syntax.
^D
<table>
<caption>Demonstration of simple table syntax.</caption>
<thead>
<tr class="header">
<th align="right">Right</th>
<th align="left">Left</th>
<th align="center">Center</th>
<th align="left">Default</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="right">12</td>
<td align="left">12</td>
<td align="center">12</td>
<td align="left">12</td>
</tr>
<tr class="even">
<td align="right">123</td>
<td align="left">123</td>
<td align="center">123</td>
<td align="left">123</td>
</tr>
<tr class="odd">
<td align="right">1</td>
<td align="left">1</td>
<td align="center">1</td>
<td align="left">1</td>
</tr>
</tbody>
</table>
$pandoc-t html[返回]
左右中心默认值
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
表:简单表语法的演示。
^D
演示简单的表语法。
赖特
左边
居中
违约
12
12
12
12
123
123
123
123
1.
1.
1.
1.
那不是很好吗
[1]在处理降价输入时,您可能需要告诉Pandoc您想使用它的一些扩展名:
Pandoc--from=Markdown+raw\u html+raw\u tex+…
,以防它在默认设置下无法工作……“它没有添加”:很抱歉,这是一个输入错误,但我需要它们。请根据偶尔阅读的提示更新您的答案:它仍然没有在表内显示边框,因为您可以将border-*
变量从none
设置为,例如,1px
。是否可以将标记转换为PDF格式(其中标记包含嵌入的HTML片段)一次性?@cmcdragokai:如果你使用Pandoc,嵌入的HTML只会传递到基于HTML的输出格式(HTML、HTML5、EPUB、EPUB3、DZSlides、slidey、Slideous、RevealJS等),而对于LaTeX或PDF输出则会被忽略。我不知道还有任何其他降价转换工具可以处理您的请求。为了使桌子看起来更漂亮,我想向皮条客兜售该代码。
——感谢您显示交互式模式——非常酷。但是,关于边框,我不知道如何在标记中插入LaTeX片段来设置垂直边框。它将出现在\begin{longtable}[c]{{{rlcl}}
行中,对,使用\begin{longtable}[c]{{{r}l{124; c{124; l}}
——如果没有这个帮助,答案的乳胶部分最终不会有多大用处。