3

I'm having problems creating in black out text using the censored package I just want to be able to effectively black out some words from the PDF created by laTex.

blackout text

The "blackout" text is the same colour as the blue text. - That's fine.

Firstly, as you can see on the second line, the height of the "blackout" rectangle is considerably shorter than it should be, considering it's mean to mask the same text as the line above.

Secondly, phone numbers & an email address aren't getting blocked out. Not sure why. I thought it might be due to spaces (in the case of the phone number) but as you can see from the laTex I've covered both cases.

% document class
\documentclass[a4paper,11pt,final]{memoir}

%set pdf to print transparency properly
\pdfminorversion 7

% stuff
\pagestyle{empty} % no page numbering
\setlength{\parindent}{0pt}     % no paragraph indentation

% required packages (add your own)
\usepackage{flowfram}                   % column layout
\usepackage[top=1cm,left=1cm,right=1cm,bottom=1cm]{geometry}% margins
\usepackage{graphicx}                   % figures
\usepackage{hyperref}           % hyper links
\usepackage[svgnames]{xcolor} % Call colours by their svgnames
\usepackage[UKenglish]{babel} % English language/hyphenation
\usepackage[none]{hyphenat} % no hyphenation
\usepackage{censor} % blackout text

% Create column layout
% define length commands
\setlength{\vcolumnsep}{\baselineskip}
\setlength{\columnsep}{\vcolumnsep}

% define custom colours
\definecolor{OceanBlue}{RGB}{37,133,208}
\definecolor{BlueGrey}{RGB}{91,126,153}

% get rid of ugle hyperref boxes
\hypersetup{
  colorlinks   = true, %Colours links instead of ugly boxes
  urlcolor     = black, %Colour for external hyperlinks
  linkcolor    = black, %Colour of internal links
  citecolor   = red %Colour of citations
}

% define macros for spacer
\newcommand{\SmallSep}{\vspace{0.5em}}
\newcommand{\BigSep}{\vspace{1em}}

% KEYWORD IDENTIFIERS:
\def\Missile{\censor*{7}}
\def\Size{\censor*{2}}
\def\`password'{\censor*{7}}
\def\someone@something{\censor*{7}}
\def\01234567890{\censor*{7}}
\def\01234 567 890{\censor*{7}}

\begin{document}

\fontsize{26}{26}
\color{OceanBlue}
\usefont{OT1}{phv}{b}{n}

\begin{center}

the Missile silo\\
the {\Missile} silo\\

\fontsize{11}{13}
\usefont{OT1}{phv}{m}{n}

\usefont{OT1}{phv}{b}{n}%bold
Telephone: 
\usefont{OT1}{phv}{m}{n}%normal
01234 567 890\\
\usefont{OT1}{phv}{b}{n}%bold
Telephone: 
\usefont{OT1}{phv}{m}{n}%normal
01234567890\\

\usefont{OT1}{phv}{b}{n}%bold
E-Mail:
\usefont{OT1}{phv}{m}{n}%normal
\href{mailto:mailto:someone@something.biz}{someone@something.biz}\\
\SmallSep

\href{https://vimeo.com}{https://vimeo.com}
\color{BlueGrey}
password: {\`password'}\\
\color{Black}

%end centre alignment
\end{center}
\end{document}
3
  • Why isn't a normal % comment an option? – Sean Allred Jul 3 '15 at 20:01
  • Or use the package for this - is it comment? (I've never used it.) But, in any case, how exactly are we supposed to guess what the problem is with this little information? Other than urging you to define at least one flow frame prior to input line 64, I am not sure what we could possibly say. – cfr Jul 3 '15 at 22:02
  • Rewritten question - fresh this morning. Hopefully it'll make sense now. Sorry about the mess. – Ghoul Fool Jul 4 '15 at 7:27
4

EDIT

I think this is really a pseudo bug in the censor package. According to the manual the default height of the censor line is supposed to be 2.1ex. So for larger fonts the line height of the censoring line should be larger whereas, in fact, the height of the censored line is always the same. The problem is that censor.sty defines \censorruleheight to be a length and then sets it to be equal to 2.1ex. As \censorruleheight is a length, when it is set equal to 2.1ex this is converted straight away to 9.90062pt and thereafter censored lines always have this fixed height. A better option would be for the package to replace \censorruleheight with a macro that expands to 2.1ex. Indeed, if we add the line

\def\censorruleheight{2.1ex}

to your MWE then we get the desired result:

enter image description here

For your other questions, the reason why the email address and phone numbers are not censored in your example is that you have not asked them to be: you need to surround them with \censor{...}, or replace them with a macro as you have done with \Missile. You do define the macros

\def\01234567890{\censor*{7}}
\def\01234 567 890{\censor*{7}}

but there are two problems with these. First, you don't actually use these later in the document. More importantly, however, tex does not like having numbers or spaces in macro names so if you do try and use these then they will not work. Something like

\def\HomePhone{\censor*{7}}
\def\WorkPhone{\censor*{7}}

would be better. For the image above I have just used \censor{...} around the phone numbers.

Here is the full code:

% document class
\documentclass[a4paper,11pt,final]{memoir}

%set pdf to print transparency properly
\pdfminorversion 7

% stuff
\pagestyle{empty} % no page numbering
\setlength{\parindent}{0pt}     % no paragraph indentation

% required packages (add your own)
\usepackage{flowfram}                   % column layout
\usepackage[top=1cm,left=1cm,right=1cm,bottom=1cm]{geometry}% margins
\usepackage{graphicx}                   % figures
\usepackage{hyperref}           % hyper links
\usepackage[svgnames]{xcolor} % Call colours by their svgnames
\usepackage[UKenglish]{babel} % English language/hyphenation
\usepackage[none]{hyphenat} % no hyphenation
\usepackage{censor} % blackout text

% Create column layout
% define length commands
\setlength{\vcolumnsep}{\baselineskip}
\setlength{\columnsep}{\vcolumnsep}

% define custom colours
\definecolor{OceanBlue}{RGB}{37,133,208}
\definecolor{BlueGrey}{RGB}{91,126,153}

% get rid of ugle hyperref boxes
\hypersetup{
colorlinks   = true, %Colours links instead of ugly boxes
urlcolor     = black, %Colour for external hyperlinks
linkcolor    = black, %Colour of internal links
citecolor   = red %Colour of citations
}

% define macros for spacer
\newcommand{\SmallSep}{\vspace{0.5em}}
\newcommand{\BigSep}{\vspace{1em}}

% KEYWORD IDENTIFIERS:
\def\Missile{\censor{Missile}}
\def\Size{\censor*{2}}
\def\`password'{\censor*{7}}%      bad macro name - DON'T use!
\def\someone@something{\censor*{7}}
\def\01234567890{\censor*{7}}%     bad macro name - DON'T use!
\def\01234 567 890{\censor*{7}}%   bad macro name - DON'T use!

\def\censorruleheight{2.1ex}% to fix bug in censor.sty

\begin{document}

\fontsize{26}{26}
\color{OceanBlue}
\usefont{OT1}{phv}{b}{n}

\begin{center}

the Missile silo\\
the {\Missile} silo\\

\fontsize{11}{13}
\usefont{OT1}{phv}{m}{n}

\usefont{OT1}{phv}{b}{n}%bold
Telephone:
\usefont{OT1}{phv}{m}{n}%normal
01234 567 890\\
\usefont{OT1}{phv}{b}{n}%bold
Telephone:
\usefont{OT1}{phv}{m}{n}%normal
\censor{01234567890}\\

\usefont{OT1}{phv}{b}{n}%bold
E-Mail:
\usefont{OT1}{phv}{m}{n}%normal
\censor{\href{mailto:mailto:someone@something.biz}{someone@something.biz}}\\
\SmallSep

\href{https://vimeo.com}{https://vimeo.com}
\color{BlueGrey}
password: {\`password'}\\
\color{Black}

%end centre alignment
\end{center}
\end{document}
1
  • @StevenB.Segletes I think that there is a small bug in your censor package. Please let me know if I am wrong. – user30471 Jul 4 '15 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.