# Clipping a formula to make a nice compliment

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".

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}

-
I noticed someone has down voted this question. But not me for sure! –  kiss my armpit Nov 3 '12 at 11:27

With tikz:

Also with a more condensed font:

# Code:

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

\usepackage{tikz}
\usetikzlibrary{calc}

\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}

-
@percusse: Good addition. Thanks. –  Peter Grill Nov 3 '12 at 15:38

## Method 1

Just 4 fun with PSTricks.

\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}

-

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}
$128 \sqrt{e 980}$