我在设置方面有问题\parskip=0pt
,不是在我的.pdf
,而是在我的.html
我想要一个新的环境\parskip=0pt
,但make4ht -ul myfile.tex
不尊重我的定义。
似乎有一个技巧\obeylines
,其中的 parskip 减少了.html
,但我并不想这样。
\documentclass[oneside,a4paper, 12pt]{article}
%\usepackage[french]{babel}
%\usepackage[style=french]{csquotes}%
\usepackage{alternative4ht}
\altusepackage{polyglossia}
\altusepackage{fontspec}
%\setdefaultlanguage{french}
%\def\obeylines{\catcode`\^^M\active \let ^^M\par }
%%%%%%%% DO NOT FORGET THE SPACES:
%\def\disobeylines{\catcode ‘\^^M=5 }
\newenvironment{dialogue}
{
%\obeylines
\parskip=0em
\relax
%\par
}{\par}
\newenvironment{dialogueobeylines}{\parskip=0em\relax
\obeylines
}
%\par
\setlength{\parindent}{0ex}
\setlength\parskip{1ex plus 0.5ex minus 0.5ex}
\begin{document}
Accidentally left the caps lock on and typed something, but can't be bothered to start again and retype it all?
QQQ.
Simply enter your text and choose the case you want to convert it to.\\
\textbf{begin of the dialogue. check the parskip}\\
\begin{dialogue}
Accidentally left the caps lock on and typed something, but can't be bothered to start again and retype it all?
QQQ
Simply enter your text and choose the case you want to convert it to.
\end{dialogue}
\textbf{end of the dialogue}\\
\textbf{begin of the dialogueOBEYLINES. check the parskip}\\
\begin{dialogueobeylines}
Accidentally left the caps lock on and typed something, but can't be bothered to start again and retype it all?
%QQQ
{}
Simply enter your text and choose the case you want to convert it to.
\end{dialogueobeylines}
\textbf{end of the dialogueOBEYLINES}\\
\end{document}
答案1
对于这种情况,您需要使用一些辅助 html 元素将段落括在环境中,然后使用 CSS 设置它们的样式。您可以使用\ConfigureEnv
命令轻松添加此类元素。定义如下所示(hello.cfg
):
\Preamble{xhtml}
\def\ClosePar{\ifvmode\IgnorePar\fi\EndP}
\ConfigureEnv{dialogue}
{\ClosePar\HCode{<div class="dialogue">}\par}
{\ClosePar\EndP\HCode{</div>}}{}{}
\Css{.dialogue p.indent, .dialogue p.noindent{margin-bottom:0;margin-top:0;}}
\Css{.dialogue{margin-bottom:0.5em;margin-top:-1em;}}
\begin{document}
\EndPreamble
此配置插入<div class="dialogue">
环境周围,然后使用 CSS 轻松配置。请注意,我们必须使用.dialogue p.indent, .dialogue p.noindent
来设置段落样式。