3

Is there a nice way to overlay text in the space of one character?

So if text is overlaid as I described it would almost result in a black square.

Werner
  • 603,163
user7630
  • 105
  • 4

2 Answers2

5

You could use soul, for example:

\documentclass{article}
\usepackage{soul}
\makeatletter
\def\SOUL@soeverytoken{\rlap{\the\SOUL@token}}
\makeatother
\newcommand{\stack}[1]{%
  \let\space\relax% no space desired
  \so{#1}}
\begin{document}
\stack{S}

\stack{So}

\stack{So if this text}

\stack{So if this text is stacked as I described it would almost result to a black square.}
\end{document}

stacking characters

Stefan Kottwitz
  • 231,401
  • This is exactly what I was looking for but in my case the text is input from a file. Like \stack{\input{Text}} but this results to File not found error. – user7630 Sep 03 '11 at 18:21
  • @user7630: You did not mention this in your question. However, in order to avoid mixing topics, I suggest posting a follow-up question such as "How can I use \input within arguments" or "... within soul arguments". – Stefan Kottwitz Sep 03 '11 at 18:42
  • I think I'll do that – user7630 Sep 03 '11 at 18:52
4

this is kind of kludgy, and can be handled more elegantly as a loop, but i'll leave that nicety to someone else.

\rlap{a}\rlap{b}\rlap{c}\rlap{d}...z

(where z is the final glyph in the string) will have the effect of setting the successive glyphs on top of one another. (i interpret that as what you mean by "stack", rather than setting the glyphs as a "tower" with one above the other.)