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.

I manage style files for an academic journal. A typical article will contain authors' email addresses, which we attempt to obfuscate in order to give some measure of protection against e-mail harvesters.

Our current strategy: We replace the @ and . in e-mail addresses with bitmapped images of these symbols. (Specifically, we define new commands \imageat and \imagedot which print .pdf images of their respective characters; then an email address like me@place.com is typeset as me{\imageat}place{\imagedot}com.) This has some problems:

  1. The images don't reflect the font or size of the surrounding text.
  2. With this solution, our LaTeX distribution must include the .pdf of these images, which can lead to errors and confusion.

What I would like: I would like (you to tell me how) to define two commands \crazyat and \crazydot which have the effect of typesetting @ and . in the current typeface, but appear as non-standard characters in the generated .pdf file. Specifically, I would like to temporarily populate a little used part of the current font with the @ and . so that they appear correctly, but make no sense to anyone else. (Other suggestions very welcome.)

A few notes about other postings on this (and closely related topics):

  1. I am aware of the AccSup package. It seems very appealing, but only Adobe Acrobat seems to play along. Specifically, the LaTeX line My email address is \BeginAccSupp{ActualText={email address}}me@place.com\EndAccSupp{} produces output that copies and pastes (in)correctly with Adobe Acrobat (giving the intended behavior) but misbehaves (so that copy/paste gives the e-mail address) on other .pdf readers. Anyway, I guess this will not fool an e-mail harvester. (See What can cause generated PDF document whose text are not correctly copyable?.)
  2. I do not want to, e.g., simply replace the @ symbol with the text [AT]. I am dead set on this symbol actually appearing correctly in the .pdf document. (See How to redefine @ and . to obfuscate email addresses?.)
  3. There seems to be a way to blow away the "cmap," which I do not understand. However, I would only like to be "locally" destructive--I would like the rest of the document to be well-formed. (See Is it possible to produce a PDF with un-copyable text?.)
share|improve this question
2  
What do you think about drawing @ with few commands using Tikz, for example. Then you can use it any time. Also you can put it on a box such that it would be possible to resize it together the text. –  Sigur Jan 24 '13 at 1:19
5  
My favorite obfuscation: john.doemy@pantsfoo.com – to e-mail me, remove my pants. From a related question on Super User, but with a focus on HTML/web sites: Does e-mail address obfuscation actually work? –  doncherry Jan 24 '13 at 2:12
    
@Sigur Hm, well, there’s the PGF/TikZ library shapes.letters at launchpad:tex-sx that transforms letters into shapes. I have never tested the library but my guess would be that the actual text representation is lost in the final output. –  Qrrbrbirlbel Jan 24 '13 at 2:20
    
I don't exactly see the problem with having the @ and the . as vector (not bitmap, please) PDFs alongside your LaTeX source. You have to do the same with your images anyway, don't you? In any case, you can adapt the size of the symbols automatically by using something along the lines of \includegraphics[width=1em]{atsign} as your \crazyat macro. –  Christian Jan 24 '13 at 2:49
1  
Consider randtext. –  Werner Jan 24 '13 at 2:59
show 12 more comments

1 Answer 1

up vote 6 down vote accepted

To provide PDF files containing the dot and the at in the right font, put this in at.tex

\documentclass{standalone}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\begin{document}
@
\end{document}

and likewise this in dot.tex

\documentclass{standalone}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\begin{document}
.
\end{document}

Edit: This solution was actually wrong as I first wrote it. I assumed you can just use the generated PDFs as a neutral vector graphic. You can't; the mail addresses are still easily copy-and-pasted. You can, however, use some software like inkscape to convert the text to a "real" vector graphic and save it as a PDF again. You can then proceed as before. [End of Edit]

\documentclass[a5paper]{article}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\newcommand{\crazyat}{\includegraphics[width=.9em]{at}}
\newcommand{\crazydot}{\includegraphics[width=.25em]{dot}}
\begin{document}
\noindent foobar@example.com\\
foobar\crazyat{}example\crazydot{}com\\
\Large foobar@example.com\\
foobar\crazyat{}example\crazydot{}com
\end{document}

Which looks good to my eye:

comparison between obfuscated and normal mail address

share|improve this answer
    
It looks like the link to inkscape is missing the i. –  acr Jan 24 '13 at 12:33
    
Thanks for working this up. Is there a principled way to ensure that I place, for example, the @ character at exactly the right height? –  acr Jan 24 '13 at 12:43
    
@acr I cannot think of an automatic way to determine the width in em. As you can see, using the font size-dependent unit em ensures that the whole thing scales well once you figured out the right number (works less well with fonts like Computer Modern that look different at different sizes). You could use gimp to produce arbitrary-sized renderings and then overlay the two lines with 50% transparency. –  Christian Jan 24 '13 at 13:17
2  
\includegraphics[height=\fontcharwidth\font`A]{at} should make the height equal to that of an A. Similarly for the period: height=\fontcharheight\font`. –  egreg Jan 24 '13 at 13:17
    
@egreg Excellent! (It should be \fontcharheight in the first example, right?) Also, wouldn't we want the height to match that of an @? Finally, I guess that both the @ and the . rest precisely on the baseline, so there is no need for a \raisebox? Is there a reason that we couldn't use this same idea to set the width to the correct value (based on the current font)? (I understand that one would probably want to set only one of these to keep the aspect ratio correct.) –  acr Jan 24 '13 at 14:18
show 3 more comments

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.