3

This question is in relation to one of my previous questions: How to replace a large block of text by an empty block of the same size?

Is it possible to generate a "blank" font using the metrics of another font in LaTeX? Can this be done "on the fly", during the typesetting of the document?

digital-Ink
  • 3,083
  • Not "on the fly", without substantial work. Moreover this would defeat your purpose, as the metric information and the character names would be present in the output. – egreg Jun 05 '12 at 12:45
  • 3
    Are you after something substantially different than \textcolor{white}{Some text}? – Scott H. Jun 05 '12 at 16:08
  • 1
    You could also produce transparent text as per the answers here – Scott H. Jun 05 '12 at 16:19
  • @ScottH. Please see the linked post. Changing color is the easiest alternative and has a similar effect, but it is not the same. – digital-Ink Jun 05 '12 at 16:47
  • You're right, my bad...I didn't read the entire post! The transparent text with a switch may have the desired effect though. – Scott H. Jun 05 '12 at 16:49
  • @Scott: I'm pretty sure the shadow in your (deleted) answer is just an artifact of the viewer. It would be interesting to know what problems with \textcolor{white} you have, digital-Ink. – Hendrik Vogt Jun 05 '12 at 16:50
  • @HendrikVogt: Please see the linked post for what I want to achieve. I believe that this (replacing with a blank similar font) may be a way of solving that problem. I tried also to change all color to white and it works, but not perfectly, the final layout of the document is a little bit changed than that using real, black text (especially on the vertical). – digital-Ink Jun 05 '12 at 16:57
  • @digital-Ink: I read that linked post, but wondered what the actual problem is. Can you produce a minimal example showing the problems with vertical spacing? – Hendrik Vogt Jun 05 '12 at 17:01
  • @HendrikVogt: The document where I need to "hide" some portions of the text (and replace that with blank space) is quite large and uses several .sty files with lot of customization, so it would be hard to put it here or to follow it. The general idea is that using white text produces the best result so far, but on some pages the text does not keep its original position and the page breaks faster or earlier than in the original (full/with black text) document. – digital-Ink Jun 05 '12 at 18:23
  • 2
    @digital-Ink: It's still worth trying to produce a minimal example - you might find a bug in one of the packages! For each package, you could try to see what happens if you remove it. – Hendrik Vogt Jun 06 '12 at 09:41

2 Answers2

2

Edit: different method.

Depending on what you want to do with it, the implementation could likely be improved, but how about the following:

\documentclass{article}
\usepackage{xcolor}
\usepackage{transparent}
\usepackage{etoolbox}

\newbool{trans}

\newcommand{\transon}{
    \booltrue{trans}
}
\newcommand{\transoff}{
    \boolfalse{trans}
}
\newcommand{\ttext}[1]{
    \ifbool{trans}
        {\texttransparent{0}{#1}}
        {#1}
}

\begin{document}

\transoff{}
\ttext{Here is some text.}

\transon{}
\ttext{Here is some text.}

\end{document}
Scott H.
  • 11,047
2

@digital-Ink: am not sure this answers your question but the command \special{color rgb X Y Z} changes the color of the `pen' until the document ends or you change the color again. Here X Y Z is the rgb color specification, so you could just change it to white, i.e.

\special{color rgb 1 1 1}

would change the font color to white but of course latex keeps going as though nothing happened.

\special{color rgb 0 0 0}

changes it back to normal.