是否有可能以某种方式用以下属性来突出显示/标记线条?
- 这是段落的最后一行
- 和:
- 任何一个它结束于文本宽度右端的 1em 范围内;
- 或者少于 7 个字符。
超满警告将在草稿模式下标记超满的行。我正在寻找类似的东西,能够自动标记不符合某些印刷指南的行。然后例如,可以根据以下规则更正段落的“几乎已满”的最后几行 这个TexExchange答案
更新:我怀疑,与这个最近问题。
答案1
这并不是确切的要求,但在紧急情况下可能会有所帮助。首先,让我们讨论一下这种方法的缺点:
它需要一个环境
ProcessPars
来衬托要检查的文本。它无法从左边距计算 7 个字符;相反,它会寻找
7ex
宽度小于的最后一行。如果段落最后一行被挤压,则突出显示标记会自动显示在下一行。
MWE,其中符合要求的段落在左边距用红色项目符号标出。
\documentclass{article}
\usepackage{tabto,xcolor,environ}
\newcommand\checkloc{%
\tabto*{-20pt}%
\ifdim\TabPrevPos<7ex\relax\makemark\else%
\ifdim\TabPrevPos>\dimexpr\linewidth-1em\relax\relax\makemark\fi%
\fi
\tabto{\TabPrevPos}%
}
\newcommand\makemark{\textcolor{red}{$\bullet$}}
\long\def\processparsaux#1\par#2\relax{%
#1\checkloc\par\ifx\relax#2\relax\else\processparsaux#2\relax\fi%
}
\NewEnviron{ProcessPars}{\expandafter\processparsaux\BODY\par\relax}
\newcommand\showrules{%
\noindent\hspace{7ex}\smash{\rule[-\textheight]{.4pt}{\textheight}}\hfill%
\smash{\rule[-\textheight]{.4pt}{\textheight}}\hspace{1em}\mbox{}\par
}
\begin{document}
\showrules
\begin{ProcessPars}
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. This is a test. This is big/fat.
This is a test. This is a test. This is a test. This is a test. This is a big test.
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
\end{ProcessPars}
\end{document}