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.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityYou 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}
\stack{\input{Text}}
but this results to File not found error.
\input
within arguments" or "... within soul
arguments".
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.)
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
.