Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

What I want to achieve is a text block with zero or, better, nearly zero leading and with searchable text.

Example:

The above example is a tikz picture, created with inkscape and exported to tikz.

My own efforts did only lead to something like this, which apparently is not sufficient in any case:

example2

The source:

\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}
share|improve this question
    
Change \color{DarkRed}pitbull to \textcolor{DarkRed}{pitbull}? –  hpesoj626 Mar 8 '13 at 10:03
    
In your first image, what if the p of pitbull and the b of behaved coincide vertically? They will overlap... is that acceptable? Apparently you want a negative lead, instead of a 0pt lead... –  JLDiaz Mar 8 '13 at 10:06
2  
You could set \lineskiplimit to some negative value, so that overlapping lines don't push the lines apart, e.g. \lineskiplimit=-20pt and set baselineskip to some smaller value e.g. \fontsize{42}{30}\selectfont. I don't think that the redefinition of \baselinestretch is really senseful. –  Ulrike Fischer Mar 8 '13 at 10:18
    
Yes, \lineskiplimit=-20pt does exactly what I want. –  permaneder Mar 8 '13 at 10:29
    
“which apparently is not sufficient in my case” – I’m curious: why “apparently”? Who set the requirement, what’s the rationale? –  Konrad Rudolph Mar 8 '13 at 12:54

2 Answers 2

up vote 9 down vote accepted

Here's a commented code achieving the goal.

\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}

enter image description here

share|improve this answer
    
Since you've set the width of the \parbox suitably, do you need all those \par statements? –  Mico Mar 8 '13 at 12:29
    
@Mico Just to be sure. –  egreg Mar 8 '13 at 12:33
    
Your code compiles perfectly -- at least when compiled with MacTeX and MacOS X 10.7.5 -- without the \par statements. :-) –  Mico Mar 8 '13 at 12:50
    
@Mico That's true; but I won't leave to the software decisions that belong to me. :) –  egreg Mar 8 '13 at 12:54

Here is a possible solution. Not sure if it produces what you want. I edited a bit the settings so I can compile it without the required font.

You can adjust the vertical distance between baselines at the \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}

Result

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.