![为什么在 \item 之后使用 \begin{description} 时 tex4ht 会添加一个额外的换行符?](https://linux22.com/image/355082/%E4%B8%BA%E4%BB%80%E4%B9%88%E5%9C%A8%20%5Citem%20%E4%B9%8B%E5%90%8E%E4%BD%BF%E7%94%A8%20%5Cbegin%7Bdescription%7D%20%E6%97%B6%20tex4ht%20%E4%BC%9A%E6%B7%BB%E5%8A%A0%E4%B8%80%E4%B8%AA%E9%A2%9D%E5%A4%96%E7%9A%84%E6%8D%A2%E8%A1%8C%E7%AC%A6%EF%BC%9F.png)
Tex4ht 在使用时似乎表现不佳\begin{description}
。它产生的输出在每个条目后添加新行item[x]
。而在 PDF 中它可以正常工作。
下面是 HTML 输出和 PDF 输出的 MWE 和屏幕截图。\begin{description}
由于生成的 HTML 看起来很糟糕,因此无法在 tex4ht 中使用。
\documentclass[11pt]{article}% MWE shows problem with tex4ht
\begin{document}
Example 1
\begin{description}
\item[1] A
\item[2] B
\item[3] C
\item[4] D
\item[5] E
\end{description}
Example 2
\begin{description}
\item[] A
\item[] B
\item[] C
\item[] D
\item[] E
\end{description}
Example 3
\begin{enumerate}
\item A
\item B
\item C
\item D
\item E
\end{enumerate}
\end{document}
使用 编译make4ht bug.tex
。以下是并排的 HTML 和 PDF
请注意,使用时\item[]
它可以正常工作,但是当在项目内放置一些值时,它会添加新行,而它应该像 PDF 输出一样保持在同一行。ie 的\item[1]
工作方式与 不同\item[]
。这是上面的示例 1。示例 2 和 3 都可以。
我正在使用 texlive 2016 的最新更新
which tex4ht
/usr/local/texlive/2016/bin/x86_64-linux/tex4ht
这是 tex4ht 中已知的问题吗?有解决方法吗?
答案1
将 HTML 描述列表的样式设置为与 LaTeX 描述列表的样式并不容易。以下是我的尝试:
\Preamble{xhtml}
\Css{dl:after {content:"";display:table;clear:both;}}
\Css{dt{float:left;min-width:3em;clear:left;}}
\Css{dd{float:left;}}
\begin{document}
\EndPreamble
dt
和元素dd
包含描述标签和文本。我们使用一些简单的 CSS 将它们放在同一行。请注意,它并非在所有情况下都有效:
所以多行描述仍然以新行结束。我不知道如何解决这个问题。