受到一篇题为“为什么大写字母很难阅读“,我想为我的文档产生以下结果。
平均能量损失
\documentclass[preview,border=12pt,varwidth]{standalone}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\end{document}
问题
如何自动完成此操作?
为了灵活,设 r
是移除的比例height
(相对于基线)。
奖励:如何在修剪之前将所有字符转换为大写?
答案1
答案2
\documentclass[preview,border=12pt,varwidth]{standalone}
\usepackage{lipsum,color}
\begin{document}
\lipsum[1]
\vspace{-\dimexpr\parskip+\baselineskip}
\edef\NN{\the\prevgraf}
\noindent\begin{picture}(0,0)
\multiput(0,0)(0,12){12}{\textcolor{white}{\rule[-2pt]{\linewidth}{5pt}}}
\end{picture}
\end{document}
答案3
这是另一个基于 Ti 的提案钾Z 和 lineno。您只需调整\TruncateRatio
即可获得不同的截断率r
。如果您只想截断文本的一部分,请将其放在和之间\begin{runninglinenumbers}
(\end{runninglinenumbers}
并注释掉\linenumbers
)。David Carlisle 的评论\MakeUppercase
也适用于此处。我发布此评论的原因(考虑到其他出色的答案)是,使用不透明度很简单,也许更重要的是,它也可以用于方程式。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\tikznode}[2]{%
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};%
}%from https://tex.stackexchange.com/questions/402462/tikz-equivalent-of-pstricks-commands-ncbar-and-rnode/402466#402466
\usepackage{lineno}
\usepackage{lipsum}
\newcommand{\TruncateRatio}{0.5}
\renewcommand\makeLineNumber
{\tikznode{left}{\strut}\ \rlap{\hskip\textwidth\ \tikznode{right}{\strut}}
\tikz[overlay,remember picture]{\fill[white](left.south)rectangle($(right.south)!\TruncateRatio!(right.north)$);}}
\begin{document}
\linenumbers
\lipsum[1]
\begin{linenomath*}
\begin{eqnarray*}
b_1 &=& a_{11}x_1 + a_{12}x_2 \\
b_2 &=& a_{21}x_1 + a_{22}x_2
\end{eqnarray*}
\end{linenomath*}
\lipsum[2]
\end{document}
答案4
钛钾Z 解决方案(Ti 的快速修改版本钾基于 Z 的多行下划线)。它不适用于多页,并且如果行距大于\baselineskip
。这重用了https://tex.stackexchange.com/a/411361/117050和https://tex.stackexchange.com/a/411655/117050。
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{tikzpagenodes}
\usepackage{refcount}
\tikzset{tikzCUT/.style={line width=1.1ex,white}}
\makeatletter
\newcommand{\gettikzxy}[3]{% from https://tex.stackexchange.com/a/58590/121799
\tikz@scan@one@point\pgfutil@firstofone#1\relax
\xdef#2{\the\pgf@x}%
\xdef#3{\the\pgf@y}%
}
\newlength\tikzCUT@length
\newcount\tikzCUT@count
\newcommand*{\tikzCUT}[1][0ex]{%
\if\relax\detokenize{#1}\relax
\tikzCUT@length=0ex\relax
\else
\tikzCUT@length=#1\relax
\fi
\tikzCUT@}
\newcounter{tikzCUTCounter}
\newcommand{\tikzCUT@}[2][-0.1ex]{%
\tikz[remember picture,overlay, baseline=(Begin.base)]{%
\node[anchor=base,inner sep=0pt,outer sep=0pt,xshift=-\tikzCUT@length]
(Begin) {\strut};
\gettikzxy{($(Begin.base)-(current page.south west)$)}
{\tikzCUT@bx}{\tikzCUT@by}%
}%
\stepcounter{tikzCUTCounter}%
\tikzCUT@label{begin}%
#2%
\tikzCUT@label{end}%
\expandafter\tikzCUT@pagecheck\expandafter{\the\c@tikzCUTCounter}%
\tikz[remember picture,overlay, baseline=(End.base)]{%
\node[anchor=base,inner sep=0pt,outer sep=0pt,xshift=+\tikzCUT@length]
(End) {\strut};%
\gettikzxy{($(End.base)-(current page.south west)$)}
{\tikzCUT@ex}{\tikzCUT@ey}%
}%
\begin{tikzpicture}[overlay,remember picture]
\ifdim\dimexpr\tikzCUT@ey-\tikzCUT@by = 0pt
% one line
\draw[tikzCUT] ($(Begin.base)+(0,#1)$) -- ($(End.base)+(0,#1)$);%
\else
% multiple lines
\draw
($(current page text area.west)-(\tikzCUT@length,0)$) node(WestLine){};
\draw
($(current page text area.east)+(\tikzCUT@length,0)$) node(EastLine){};
\tikzCUT@drawBtoE{#1}
\ifdim\dimexpr\tikzCUT@by-\tikzCUT@ey>\baselineskip
% more than two lines
\bgroup
\tikzCUT@drawMultipleLines{#1}{\baselineskip}
\egroup
\fi
\fi
\end{tikzpicture}}
\newcommand*\tikzCUT@label[1]{%
\null
\@bsphack
\protected@write\@auxout{}{%
\string\newlabel{tikzCUT:#1:\arabic{tikzCUTCounter}}
{{\@currentlabel}{\arabic{page}}}}%
\@esphack}
\newcommand*\tikzCUT@pagecheck[1]{%
\typeout{\pageref{tikzCUT:begin:#1}}%
\typeout{\pageref{tikzCUT:end:#1}}%
\ifnum\getpagerefnumber{tikzCUT:begin:#1}=%
\getpagerefnumber{tikzCUT:end:#1}\relax
\else
\GenericError{Multi-page warning}{AHHHH}{}%
\fi}
\newcommand*\tikzCUT@drawMultipleLines[2]{%
\tikzCUT@length=#2
\tikzCUT@count=1
\loop\ifdim\dimexpr\tikzCUT@by-\tikzCUT@count\tikzCUT@length>\tikzCUT@ey
\draw[tikzCUT]
($(Begin.base -| WestLine)+(0,#1)-(0,\tikzCUT@count\tikzCUT@length)$)--
($(Begin.base -| EastLine)+(0,#1)-(0,\tikzCUT@count\tikzCUT@length)$);
\advance\tikzCUT@count by 1
\repeat}
\newcommand*\tikzCUT@drawBtoE[1]{%
\draw[tikzCUT]
($(Begin.base)+(0,#1)$) -- ($(Begin.base -| EastLine)+(0,#1)$)
($(End.base)+(0,#1)$) -- ($(End.base -| WestLine)+(0,#1)$);}
\makeatother
\begin{document}
\tikzCUT{this foo away}
\end{document}