# Transform existing text into blind text or gibberish keeping format (wireframing)

Suppose I have a document that took me a while to design and write. Now I want to show someone the overall format and length of the document but I don't want this person to read or even be distracted by the actual content. How can I change the text to remove content but keep more or less the same format?

One option would be to go through the whole document and replace invididual text chunks by carefully measured lipsums. But that it is lot of work.

Another option is to simply replace letter by letter in the content (not in the commands of course) with some (random?) rule to get the same word by word structure. (Suppose the possibility of decryption is not a pressing issue).

Can I achieve this transformation in the whole document? For example a package or a couple of commands at the start of the document.

Minimal example:

\documentclass{article}
\begin{document}
This has a lot of content
\end{document}


how to produce a document as if the source was:

\documentclass{article}
\begin{document}
Blah bla a bli ba blihbla
\end{document}

• How would this work? What would happen to \cite{<some key>}, for example? Or \printbibliography? What about \includegraphics{} or diagrams? Moreover, replacing the text will also affect the line and page breaks. Even if you replace letter-by-letter, it will change the breaks because characters have different widths and gibberish words will not be hyphenated. It isn't clear what 'more-or-less the same format' means? How much of the more do you need and how much of the less? – cfr Sep 9 '15 at 21:39
• Yes, good question. That is why I am asking, some commands do have content (e.g. \section{...}), and some others \includegraphics do not have content or cannot be changed easily. at worst we can make that all command are left intact, and only top level text could be changed. Yes, hyphenation would not be the same but that is part of the "more or less". – alfC Sep 9 '15 at 21:47
• Use a different font, such as cyrillic letters ?;-) – user31729 Sep 9 '15 at 21:49
• May be easier to do this outside of TeX itself (with Perl, Python, Ruby, or some other text-processing tool). What's your operating system restrictions? – Mike Renfro Sep 9 '15 at 21:56
• I was going to suggest the randomchars function of chickenize, but I can’t get it working. Has anyone had luck with it? – Thérèse Sep 10 '15 at 0:30

Thanks to @ChristianHupfer (use other font, e.g. Cyrillic) and @JohnKormylo (suggesting "Redacted" font) and @jfbu (to give an example), I came up with this near perfect solution. I also learn that this is called "wireframing" in graphics design.

It handles 95% of the problem, the remaining bit is to redefine the includegraphics command and perhaps make the text non-copyable (if that is possible at all Is it possible to produce a PDF with un-copyable text?).

Instruction:

1) Install the Redacted font https://github.com/christiannaths/Redacted-Font

2) Use Lualatex and add this to your document

\usepackage{fontspec}
\setmainfont[
ExternalLocation={./},
BoldFont={redacted-script-bold.ttf},
ItalicFont={redacted-script-light.ttf},
BoldItalicFont={redacted-script-bold.ttf} % or use pretty names if it works for you
]{redacted-script-regular.ttf} % Redacted Script
\setsansfont[ExternalLocation={./}]{redacted-script-regular.ttf} % Redacted
\usepackage{unicode-math}
\setmathfont[range=\mathup/{num}]{redacted-script-regular.ttf}
\setmathfont[range=\mathrm]{redacted-script-regular.ttf}
\setmathfont[range=\mathit]{redacted-script-light.ttf}
\setmathfont[range=\mathbf]{redacted-script-bold.ttf}


Some ideas also taken from: http://bryanwweber.com/writing/personal/2014/03/25/using-the-same-font-for-numbers-in-math-mode-in-latex/

NB: Unfortunately, I never managed to use a system font with space in its name to work with setmainfont (it can never find it), so I had to put the files in the same directory and call them by filename (let me know if you know how to do this right).

The results is very nice:

Version 2 (make italic distinguishable from upright letters)

Redacted font is too slanted and there is no "italic" variant, so I gave negative slant for regular variant and positive slant for italic. (also AutoFakeBold didn't work here).

\usepackage{fontspec}
\setmainfont[
ExternalLocation={./}, FakeSlant=-0.5, AutoFakeSlant=0.5,
BoldFont={redacted-script-bold.ttf},
%    ItalicFont={redacted-script-light.ttf},
BoldItalicFont={redacted-script-bold.ttf} % or use pretty names if it works for you
]{redacted-script-regular.ttf} % Redacted Script
\setsansfont[ExternalLocation={./}, FakeSlant=-0.5]{redacted-script-regular.ttf} % Redacted
\usepackage{unicode-math}
\setmathfont[range=\mathup/{num}]{redacted-script-regular.ttf}
\setmathfont[range=\mathrm]{redacted-script-regular.ttf}
\setmathfont[range=\mathit]{redacted-script-light.ttf}
\setmathfont[range=\mathbf]{redacted-script-bold.ttf}
\setmathfont[range={"2032}]{redacted-script-regular.ttf} %solve unicode-math "prime" bug: https://tex.stackexchange.com/questions/208988/prime-gives-undefined-control-sequence-in-xelatex-with-unicode-math
%

• I would be grateful if you could tell me how to fix the last update of my question to apply the font to all the math text/symbols/numbers? – Diaa Feb 9 '20 at 3:50
• How do you install the package I don't see a .sty file? – Hao S Apr 1 '20 at 4:07
• @HaoS, there is no package to install. Only a font (at the system level), which is later detected by LuaLaTeX magic. – alfC Apr 1 '20 at 18:52
• @alfC how do I install the font? – Hao S Apr 1 '20 at 19:13
• @HaoS depends on your system. In modern Linux just download the font, double click, click install. Luatex should detect the font when running. – alfC Apr 1 '20 at 21:59

Just for fun:

\documentclass{article}
\usepackage{linearb}
\usepackage{lipsum}
\begin{document}
\small
\textlinb{\lipsum[1-3]}
\end{document}


• And what does it do? – Mensch Sep 10 '15 at 2:21
• +1 Actually, this is not a bad idea, if one could include the whole document inside a textlinb environment... . In fact it could be a matter of finding a font that looks like latin letter but are either scrambled. In LuaTeX it could be simpler thanks to the font support. I just did a quick search and I couldn't find a font (e.g. a TTF) where letters are disordered. – alfC Sep 10 '15 at 2:56
• @alfC - Try github.com/christiannaths/Redacted-Font – John Kormylo Sep 10 '15 at 14:17
• @JohnKormylo, cool, do you know if this font supports ligatures? :) – alfC Sep 10 '15 at 16:22

Based on the idea suggested in comments by Christian Hupfer to change fonts. Of course, reverse engineering is feasible easily. And maths is not handled (one could add use of package mathastext and this could even be used for Greek letters ; and one could take additional steps for large symbols too).

I use blindtext package only to get some kind of document.

\documentclass{article}
\usepackage[T1]{fontenc}

\usepackage{blindtext}

% copy this to real situation
\renewcommand\encodingdefault{U}
\renewcommand\rmdefault{pzd}
\renewcommand\sfdefault{pzd}
\renewcommand\ttdefault{pzd}

\begin{document}

\blinddocument
\end{document}


• (+1) but loading T1 seems rather pointless in this case. – cfr Oct 7 '15 at 1:48

As a follow-up to my comment, a follow-up that doesn’t fit into a comment, after experimenting and taking a closer and more caffeinated look at the documentation, I finally have the randomchars function of chickenize working. However, it seems less useful for present purposes than I expected. Here’s an example of usage:

\documentclass[12pt,a5paper]{book}
% Put chickenize after fontspec, not before, or compilation fails:
\usepackage{fontspec,chickenize,xcolor}
\begin{document}
\chapter*{Down the Rabbit-Hole}
Alice was beginning to get very tired of sitting by her sister on the
bank, and of having nothing to do. Once or twice she had peeped into
the book her sister was reading, but it had no pictures or
conversations in it, “and what is the use of a book,” thought Alice,
“without pictures or conversations?”

So she was considering in her own mind (as well as she could, for the
day made her feel very sleepy and stupid), whether the pleasure of
making a daisy-chain would be worth the trouble of getting up and
picking the daisies, when suddenly \textit{a White Rabbit with
\textcolor{red!80}{pink eyes}} ran close by her.

There was nothing so \textsc{very} remarkable in that; nor did Alice
think it so \textsc{very} much out of the way to hear the Rabbit say
to itself, ‘Oh dear! Oh dear! I shall be late!’ (when she thought it
over afterwards, it occurred to her that she ought to have wondered at
this, but at the time it all seemed quite natural); but when the
Rabbit actually \textsc{took a watch out of its waistcoat-pocket,} and
looked at it, and then hurried on, Alice started to her feet, for it
flashed across her mind that she had never before seen a rabbit with
either a waistcoat-pocket, or a watch to take out of it, and burning
with curiosity, she ran across the field after it, and fortunately was
just in time to see it pop down a large rabbit-hole under the hedge.
\end{document}


Notice that the output respects \textit{...}, \textbf{...}, and \textcolor{...}, but not \textsc{...}. Also, the result is not justified and it contains many more capitals and symbols than would ordinarily appear in text. That makes it less helpful than I’d hoped for judging the shape and typographic color of a layout. Possibly someone who’s very much at home with lua could creaate a similar function that draws its substitute characters from those most likely to appear in the language of the text?

• Very nice, perhaps it is possible to only randomize letters inside its own subset? for example lower case into random lower case, and capitals into random capitals (and leave the rest alone)? Out of curiosity, why do you say it doesn't work with \textsc? – alfC Oct 15 '15 at 6:13
• @alfC The output is different each time the document is compiled, but generally it seems to put anything — uppercase, lowercase, or small caps — where the source has \textsc{...}, whereas the commands for italics, bold, and color produce italicized, bold, or colorful gibberish. – Thérèse Oct 15 '15 at 12:43
• I'm getting the error! LaTeX Error: File chickenize.tex' not found I'm fairly sure I installed the package. – Hao S Apr 1 '20 at 4:30
• @HaoS If you use Tex Live, it should be at .../texlive/2019/texmf-dist/tex/luatex/chickenize/chickenize.tex. – Thérèse Apr 1 '20 at 4:47
• @Thérèse I use texmaker but does that matter? – Hao S Apr 1 '20 at 4:48

Python 3 solution (most of the delay was from when I had two problems):

document=r"""
\documentclass{article}
\usepackage{lipsum}
\begin{document}
\section[Short title][Invalid]{Much longer section title}{Invalid}
\textbf{Here's some bold mutable text.}
Some text here needs to be replaced.
\lipsum[1]
\begin{figure}
\includegraphics[width=\textwidth]{something.pdf}
\caption{\label{fig} Caption}
\end{figure}
\end{document}
"""

import re, codecs

def rot13(s):
return codecs.encode(s,"rot-13")

# Make list of macros we want to leave alone (by default)
immutable_macro = re.compile(r"\$^\s]*") # Make list of macros we want to obfuscate mutable_macro_string_list = [ r"\\section", r"\\textbf", ] # Define patterns to find macro arguments optional_arg = re.compile(r"\[([^$]+)\]")
mandatory_arg = re.compile(r"{([^}]+)}")
mutable_macro_list = []
for s in mutable_macro_string_list:
p = re.compile(s)
mutable_macro_list.append(p)

# Iterate over the document lines
for line in document.split('\n')[1:-1]:
matched = False
# Look for mutable macro lines, obfuscate arguments
if matched==False:
for p in mutable_macro_list:
m = p.search(line)
if m!=None:
# Print macro name
print("%s" % (line[0:m.end()]), end='')
# Print obfuscated optional arguments (if any)
m = optional_arg.findall(line)
if len(m)>0:
for g in m:
print("[%s]" % (rot13(g)), end='')
# Print obfuscated mandatory arguments (if any)
m = mandatory_arg.findall(line)
if len(m)>0:
for g in m:
print("{%s}" % (rot13(g)), end='')
matched = True
break
# Look for immutable macros or regular text
if matched==False:
m=immutable_macro.search(line)
if m!=None:
# Print macro
print("%s" % (line), end='')
else:
# Print obfuscated text
print("%s" % (rot13(line)), end='')
print()


results in:

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\section[Fubeg gvgyr][Vainyvq]{Zhpu ybatre frpgvba gvgyr}{Vainyvq}
\textbf{Urer'f fbzr obyq zhgnoyr grkg.}
Fbzr grkg urer arrqf gb or ercynprq.
\lipsum[1]
\begin{figure}
\includegraphics[width=\textwidth]{something.pdf}
\caption{\label{fig} Caption}
\end{figure}
\end{document}


Here is a solution

\documentclass{article}

`