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 just found a nice cartoon and wonder if this is possible with LaTeX as well.

If you draw "128 \sqrt{e 980}" on the blackboard (sqrt written with the root character) and erase the approximately upper half, you get "I love you".

enter image description here

Has anyone a nice suggestion how to clip the text from the following document?

\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}

{\large \[ 128 \sqrt{\text{e}980}\]}

\end{document}
share|improve this question
1  
I noticed someone has down voted this question. But not me for sure! –  Fifa Earth Cup 2014 Nov 3 '12 at 11:27
add comment

3 Answers

up vote 8 down vote accepted

With tikz:

enter image description here

Also with a more condensed font:

enter image description here enter image description here

Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\VAdjust}{0,-0.15ex}%
\begin{document}

\begin{tikzpicture}
\node (A) {$\scalebox{1.5}{128} \sqrt{\text{e}\scalebox{1.5}{980}}$};
\draw [fill=gray!10, fill opacity=0.9, draw =none] 
    ($(A.west)+(\VAdjust)$) -- 
    ($(A.east)+(\VAdjust)$) -- 
    (A.north east) -- 
    (A.north west) -- 
    cycle;
\end{tikzpicture}

\end{document}

For the condensed version

\documentclass{standalone}
\usepackage{amsmath,tikz}
\usepackage[condensed,math,light]{iwona}
\usepackage[T1]{fontenc}

\begin{document}
\begin{tikzpicture}
\path % <---- Change to clip for the clipped version
node[
     xscale=0.7,yscale=1.5,
     append after command={([yshift=-0.5pt]a.west) rectangle (a.south east)}
    ] 
(a) at (0,1) {128$\sqrt{\!\resizebox{1ex}{0.7ex}{e}\text{980}}$};
\end{tikzpicture}
\end{document}
share|improve this answer
    
@percusse: Good addition. Thanks. –  Peter Grill Nov 3 '12 at 15:38
    
add comment

Method 1

Just 4 fun with PSTricks.

enter image description here

\documentclass[pstricks,border=1pt]{standalone}
\usepackage{amsmath}
\newsavebox\IBox
\savebox\IBox{\Huge $\displaystyle 128\sqrt{\text{\LARGE e}980}$}
\begin{document}
\begin{pspicture}(\wd\IBox,\ht\IBox)
\rput[bl](0,0){\usebox\IBox}
\end{pspicture}

\begin{pspicture}(\wd\IBox,\ht\IBox)
\psclip{\psframe[linestyle=none,linewidth=0](0,0)(\wd\IBox,0.45\ht\IBox)}
\rput[bl](0,0){\usebox\IBox}
\endpsclip
\end{pspicture}
\end{document}

Method 2

With graphicx. Note that it must be compiled with either pdflatex -shell-escape filename.tex or xelatex -shell-escape filename.tex

%filename.tex
\documentclass{standalone}

\usepackage{filecontents}
\begin{filecontents*}{temporary.tex}
\documentclass{standalone}
\usepackage{amsmath}
\usepackage{mathpazo}
\begin{document}
$\displaystyle 128 \sqrt{\text{\scriptsize e} 980}$
\end{document}
\end{filecontents*}

\immediate\write18{pdflatex temporary}

\usepackage{graphicx}

\begin{document}
\includegraphics[trim=0 0 0 6.2,clip]{temporary}
\end{document}
share|improve this answer
add comment

The adjustbox package allows you to clip or trim anything in the same way \includegraphics allows it for images. It uses the same key=value interface and allows for the same options, e.g. trim=<left> <bottom> <right> <top>,clip, but also provides a shorter version Clip=<left> <bottom> <right> <top> key (note the capital C) which can even be used multiple times. You can use the original dimensions of the content as \height, \depth, \width and \totalheight in the length arguments. However, because they are space separated you need to include a length argument in { } if it ends in a macro (=space eater).

\documentclass{article}
\usepackage{adjustbox}
\begin{document}
\begin{adjustbox}{Clip=0pt 0pt 0pt {.6\height}}% clip away 60% from the top.
$128 \sqrt{e 980}$
\end{adjustbox}
% or \adjustbox{Clip=..}{...}
\end{document}

However, the standard math font doesn't do it here, the e is too high and the other characters do not build the wanted letters nicely when clipped.

Result

share|improve this answer
add comment

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.