我邀请您提供定义文档布局样式的部分解决方案。这些解决方案应该能够定义字体大小、行距(行间距离)和文本类型以及作为分部单元标题的样式。请参阅下文了解部分解决方案的定义。
应特别注意,章节单元标题的样式应与连续文本的样式完美融合,因此连续文本应整齐地围绕标题流动,确保任何页面上任意两行文本之间的距离始终是用户定义行距的倍数。
这个问题有一些部分解决方案。例如,grid
包是一个很好的起点。
我没有针对我的问题的任何解决方案(答案)的特定应用:我发布了这个问题,希望其他人可能会发现答案很有趣。这就是我不提供 MWE 的原因。
为了弥补 MWE 的不足,我保证在一周内为当前最佳解决方案颁发 500 声誉赏金,前提是该解决方案显示出一些希望。我将在两周内再颁发 500 声誉赏金。(如果两周后我还剩下 500 声誉,那么我将在三周内再颁发 500 声誉赏金 :-)。
**2015 年 9 月 3 日编辑。总共授予了 1000 点声誉。我无法回复有关此问题的任何其他评论。我也无法对任何其他解决方案发表评论。
部分解决方案部分解决方案可能假设文档没有显示数学方程式和其他用户定义的显示,因为显示可能会扰乱行间距离。此外,部分解决方案可能假设所有浮动元素(图形、表格等)都位于页面的顶部或底部。
答案1
这是一个部分解决方案
更新:新的解决方案这是(一个新包裹baseline.sty
)
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{baseline}%
\edef\mtf@size{\f@size}
\edef\mtf@baselineskip{\f@baselineskip}
\renewcommand\normalsize{%
\@setfontsize\normalsize\mtf@size\mtf@baselineskip
\abovedisplayskip \mtf@baselineskip
\abovedisplayshortskip \abovedisplayskip
\belowdisplayshortskip \abovedisplayskip
\belowdisplayskip \abovedisplayskip
\let\@listi\@listI}
\normalsize%
%%%
\newcounter{nbs}
\newlength\mttempa
\let\mtset@fontsize\set@fontsize
\def\set@fontsize#1#2#3{%
\ifdim #2 pt<\mtf@baselineskip
\mtset@fontsize{#1}{#2}{\mtf@baselineskip}%
\else
\PackageWarning{baseline}{may be the font is used with modified baseline}%
\setcounter{nbs}{0}%
\setlength{\mttempa}{#2 pt}%
\loop
\stepcounter{nbs}%
\addtolength\mttempa{-\mtf@baselineskip}%
\ifdim\mttempa>0pt
\repeat%
\setlength{\mttempa}{\mtf@baselineskip}%
\loop
\addtocounter{nbs}{-1}%
\ifnum\value{nbs}>0
\addtolength\mttempa{\mtf@baselineskip}%
\repeat%
\mtset@fontsize{#1}{#2}{\mttempa}%
\fi}
%%%
\setlength\smallskipamount{\z@}
\setlength\medskipamount{\mtf@baselineskip}
\setlength\bigskipamount{\mtf@baselineskip}
\setlength\footnotesep{\z@}
\setlength{\skip\footins}{\mtf@baselineskip}
\setlength\floatsep {\mtf@baselineskip}
\setlength\textfloatsep{\mtf@baselineskip}
\setlength\intextsep {\mtf@baselineskip}
\setlength\dblfloatsep {\mtf@baselineskip}
\setlength\dbltextfloatsep{\mtf@baselineskip}
\setlength\@fptop{\z@}
\setlength\@fpsep{\mtf@baselineskip}
\setlength\@fpbot{\z@}
\setlength\@dblfptop{\z@}
\setlength\@dblfpsep{\mtf@baselineskip}
\setlength\@dblfpbot{\z@}
\setlength\partopsep{\z@}
\def\@listi{\leftmargin\leftmargini
\parsep \z@ \topsep \z@ \itemsep\z@}
\let\@listI\@listi
\@listi
\def\@listii {\leftmargin\leftmarginii
\labelwidth\leftmarginii
\advance\labelwidth-\labelsep
\parsep \z@ \topsep \z@ \itemsep\z@}
\def\@listiii{\leftmargin\leftmarginiii
\labelwidth\leftmarginiii
\advance\labelwidth-\labelsep
\parsep \z@ \topsep \z@ \itemsep\z@}
\def\@listiv {\leftmargin\leftmarginiv
\labelwidth\leftmarginiv
\advance\labelwidth-\labelsep}
\def\@listv {\leftmargin\leftmarginv
\labelwidth\leftmarginv
\advance\labelwidth-\labelsep}
\def\@listvi {\leftmargin\leftmarginvi
\labelwidth\leftmarginvi
\advance\labelwidth-\labelsep}
\setlength\lineskip{\z@}
\setlength\normallineskip{\z@}
\setlength\lineskiplimit{-\maxdimen}
\setlength\parskip{\z@}
\jot=\mtf@baselineskip
\newcommand{\partlabelfnt}{\Large\bfseries}
\newcommand{\partfnt}{\huge\bfseries}
\newcommand{\secfnt}{\Large\bfseries}
\newcommand{\subsecfnt}{\large\bfseries}
\newcommand{\subsubsecfnt}{\normalsize\bfseries}
\newcommand{\paragraphfnt}{\normalsize\bfseries}
\newcommand{\subparagraphfnt}{\normalsize\bfseries}
\renewcommand\part{%
\if@noskipsec \leavevmode \fi
\par
\addvspace{2\mtf@baselineskip}%
\@afterindentfalse
\secdef\@part\@spart}
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{part}%
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
{\parindent \z@ \raggedright
\interlinepenalty \@M
\normalfont
\ifnum \c@secnumdepth >\m@ne
\partlabelfnt \partname\nobreakspace\thepart
\par\nobreak
\fi
\partfnt #2%
\markboth{}{}\par}%
\nobreak
\vskip \mtf@baselineskip
\@afterheading}
\def\@spart#1{%
{\parindent \z@ \raggedright
\interlinepenalty \@M
\normalfont
\partfnt #1\par}%
\nobreak
\vskip \mtf@baselineskip
\@afterheading}
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-\mtf@baselineskip}%
{\mtf@baselineskip}%
{\normalfont\secfnt}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
{-\mtf@baselineskip}%
{1sp}%
{\normalfont\subsecfnt}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{-\mtf@baselineskip}%
{-1em}%
{\normalfont\subsubsecfnt}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{-\mtf@baselineskip}%
{-1em}%
{\normalfont\paragraphfnt}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
{-\mtf@baselineskip}%
{-1em}%
{\normalfont\subparagraphfnt}}
\setlength\abovecaptionskip{\mtf@baselineskip}
\setlength\belowcaptionskip{\mtf@baselineskip}
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#1: #2}%
\ifdim \wd\@tempboxa >\hsize
#1: #2\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\renewcommand*\l@part[2]{%
\ifnum \c@tocdepth >-2\relax
\addpenalty\@secpenalty
\setlength\@tempdima{3em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
{\leavevmode
\large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
\nobreak
\if@compatibility
\global\@nobreaktrue
\everypar{\global\@nobreakfalse\everypar{}}%
\fi
\endgroup
\fi}
\renewcommand*\l@section[2]{%
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\endgroup
\fi}
\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}}
\renewcommand*\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}}
\renewcommand*\l@subparagraph{\@dottedtocline{5}{10em}{5em}}
\renewcommand\indexspace{\par \vskip\mtf@baselineskip\relax}
\renewcommand\footnoterule{%
\hrule\@width.4\columnwidth
\kern3.5\p@}
\endinput
平均能量损失
\documentclass{article}
\usepackage{baseline}
%----------------------------------
% just for the example
\newtheorem{theorem}{Theorem}[section]
\usepackage{blindtext}
%----------------------------------
% just for the show
\usepackage{tikz}
\usepackage{eso-pic}
\AddToShipoutPicture{%
\begin{tikzpicture}[overlay,remember picture]
\draw[blue!20!white,thin]
(current page.south west) grid [ystep=12pt,xstep=\paperwidth] (current page.north east);
\end{tikzpicture}}
%----------------------------------
\begin{document}
\tableofcontents
\blindmathtrue
\blindtext
\begin{center}
Lorem ipsum dolor sit amet,
\end{center}
\begin{theorem}
\blindtext
\[\bar x = \frac{1}{n}\sum_{i=1}^{i=n} x_i = \frac{x_1 + x_2 + \dots{} + x_n}{n}\]
\end{theorem}
\Blinddocument
\end{document}
用户指南指南用户界面:
1)该包使用类中的默认字体大小10pt, 11pt, 12pt
,或者 9pt, 14pt, 17pt
如果允许,例如如果使用 extarticle,但用户也可以这样做
\documentclass{article}
\fontsize{15pt}{18pt}\selectfont
\usepackage{baseline}
2)该包使用类 article 中的默认设置来设置标题等部分(形状、大小……),但当然不是垂直间距。如果用户想要更改此设置,包会提供相关命令
\renewcommand{\partlabelfnt}{......} % default {\Large\bfseries}
\renewcommand{\partfnt}{......} % default {\huge\bfseries}
\renewcommand{\secfnt}{......} % default {\Large\bfseries}
\renewcommand{\subsecfnt}{......} % default {\large\bfseries}
\renewcommand{\subsubsecfnt}{......} % default {\normalsize\bfseries}
\renewcommand{\paragraphfnt}{......} % default {\normalsize\bfseries}
\renewcommand{\subparagraphfnt}{......} % default {\normalsize\bfseries}