我想要实现的是一个具有零或更好的是几乎零前导并且可搜索文本的文本块。
上面的例子是一个 tikz 图片,用 inkscape 创建并导出到 tikz。
我自己的努力只导致了这样的结果,显然无论如何这都是不够的:
来源:
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Courier Std}
\usepackage[svgnames]{xcolor}
\parindent0cm
\renewcommand{\baselinestretch}{0}
\begin{document}
\fontsize{42}{56}\selectfont
The {\color{DarkRed}pitbull} lies\\
well-behaved and\\
chained /It belc\\
hes and it snore\\
s mutedly in its\\
sleep /A melanch\\
oly muzzle on it\\
s snout.........\\
\end{document}
答案1
下面是实现目标的注释代码。
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Courier} % this is what I have
\usepackage[svgnames]{xcolor}
\begin{document}
\noindent\makebox[\textwidth][l]{% we don't want overfull box messages
\renewcommand{\fontsubfuzz}{\maxdimen}% we don't want spurious messages
\fontsize{42}{42}\selectfont % compute the text width
\settowidth{\dimen2}{A}%
\setlength{\dimen2}{16\dimen2}% 16 glyphs per line
\parbox{\dimen2}{% start a \parbox
\settoheight{\dimen0}{/}% measure the height of the tallest character
% \addtolength{\dimen0}{1pt}% finer adjustment
\fontsize{42}{\dimen0}\selectfont % set the baseline skip
\lineskiplimit=-\maxdimen\lineskip=0pt % no lines are too near
\parfillskip=0pt % paragraphs fill the line
The \textcolor{DarkRed}{pitbull} lies\par
well-behaved and\par
chained /It belc\par
hes and it snore\par
s mutedly in its\par
sleep /A melanch\par
oly muzzle on it\par
s snout.........\par
}}
\end{document}
答案2
这是一个可能的解决方案。不确定它是否能产生你想要的结果。我稍微编辑了一下设置,这样我就可以在没有所需字体的情况下编译它。
您可以在\vskip1.5ex
\documentclass{article}
\begin{document}
\thispagestyle{empty}
%\usepackage{fontspec}
%\setmainfont{Courier Std}
%\usepackage[svgnames]{xcolor}
\parindent0cm
\renewcommand{\baselinestretch}{0}
\def\crampled#1{\smash{#1}\par\vskip1.5ex}
\fontsize{42}{56}\selectfont
\crampled{The {\color{red}pitbull} lies}
\crampled{well-behaved and}
\crampled{chained /It belc}
\crampled{hes and it snore}
\crampled{s mutedly in its}
\crampled{sleep /A melanch}
\crampled{oly muzzle on it}
\crampled{s snout.........}
\end{document}