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.

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.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

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

share|improve this answer
    
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 3 '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 3 '11 at 18:42
    
I think I'll do that –  user7630 Sep 3 '11 at 18:52

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.)

share|improve this answer
1  
The mathtools package provides similar macros to \rlap, \llap and \clap in math mode: \mathrlap, \mathllap and \mathclap. See this post: Can I use \clap, \rlap and \llap in math mode? or consider reading A complement to \smash, \llap, and \rlap. –  Werner Sep 3 '11 at 17:43

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.