# Equation on papyrus with TikZ

First of all to apologize for my English.

So, many times when I teach on the board used to include the final result on papyrus (and that likes too students). Just I think that would be a good idea to do it and at my notes.

So my question: How can I get one papyrus inside to have a mathematical relationship or a text. I want to create something maybe whith TikZ that listens to commands

\papyrustrue % on the preamble

\startpapyrus
$E = m c^2$
\stoppapyrus


The \papyrustrue will switch to the papyrus displayed or not (if I comment it out %\papyrustrue). Certainly the mathematical relationship I always want to appear. I mean if I comment out the \papyrustrue not disappear and the relationship but only the papyrus. Rather it should be the papyrus as a layer over the ralationship ( .... that's what I think, maybe this idea is wrong)

At the final result I imagine something like this ( sorry for handmade figure, if I knew how to do it will not ask you, currently the score is: papyrus - karathan = 1 - 0 :-) ) I have seen this

\boxed{}, TikZ and colored equation background

but if on LateX I am relatively new I am ultimately irrelevant on TikZ

I know my question sounds rather do this for me, and I don't feel good for it... but I don't know what else to do...

Of course, I would like to hear your opinion if the idea of the papyrus is something worthwhile.

Here I put the stolen code from jpgfdrew than I use, but certainly that no help very much .

Just think maybe through the jpgfdraw and flowframe that it include maybe to manage something . . . but rather I try in vain without results ... .... never mind I survive without papyrus :-)

the score is: papyrus - karathan = 2 - 0

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{pgfpicture}{0bp}{0bp}{420.849709bp}{179.390961bp}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{32.278702bp}{137.07737bp}}
\pgfpathcurveto{\pgfpoint{5.113533bp}{147.962151bp}}{\pgfpoint{26.937674bp}{155.673503bp}}{\pgfpoint{37.413107bp}{145.194173bp}}
\pgfpathcurveto{\pgfpoint{45.642968bp}{139.580246bp}}{\pgfpoint{46.640999bp}{127.003489bp}}{\pgfpoint{34.337142bp}{127.252997bp}}
\pgfpathcurveto{\pgfpoint{0.747145bp}{137.108558bp}}{\pgfpoint{-15.689186bp}{157.100377bp}}{\pgfpoint{34.150011bp}{161.778649bp}}
\pgfpathcurveto{\pgfpoint{103.887462bp}{161.404387bp}}{\pgfpoint{428.247698bp}{121.857389bp}}{\pgfpoint{415.897059bp}{164.398482bp}}
\pgfpathcurveto{\pgfpoint{404.575639bp}{186.604683bp}}{\pgfpoint{351.368085bp}{173.848593bp}}{\pgfpoint{370.704945bp}{159.720209bp}}
\pgfpathcurveto{\pgfpoint{403.140969bp}{148.211659bp}}{\pgfpoint{410.71977bp}{167.236634bp}}{\pgfpoint{387.453161bp}{167.766838bp}}
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{37.892612bp}{39.289968bp}}
\pgfpathcurveto{\pgfpoint{107.630063bp}{38.915706bp}}{\pgfpoint{431.990299bp}{-1.754077bp}}{\pgfpoint{419.63966bp}{40.787015bp}}
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{4.343639bp}{143.814082bp}}
\pgfpathcurveto{\pgfpoint{25.92607bp}{73.0786bp}}{\pgfpoint{7.462488bp}{43.387163bp}}{\pgfpoint{2.846592bp}{23.301779bp}}
\pgfpathcurveto{\pgfpoint{15.44674bp}{3.216395bp}}{\pgfpoint{48.631287bp}{-3.146055bp}}{\pgfpoint{42.144082bp}{12.448187bp}}
\pgfpathcurveto{\pgfpoint{39.898511bp}{59.729929bp}}{\pgfpoint{31.914259bp}{104.391838bp}}{\pgfpoint{41.76982bp}{128.469348bp}}
\pgfpathcurveto{\pgfpoint{35.532123bp}{127.097055bp}}{\pgfpoint{19.064604bp}{128.344594bp}}{\pgfpoint{4.343639bp}{143.814082bp}}
\pgfclosepath
\color[rgb]{1.0,1.0,1.0}\pgfseteorule\pgfusepath{fill}
\pgfpathmoveto{\pgfpoint{4.343639bp}{143.814082bp}}
\pgfpathcurveto{\pgfpoint{25.92607bp}{73.0786bp}}{\pgfpoint{7.462488bp}{43.387163bp}}{\pgfpoint{2.846592bp}{23.301779bp}}
\pgfpathcurveto{\pgfpoint{15.44674bp}{3.216395bp}}{\pgfpoint{48.631287bp}{-3.146055bp}}{\pgfpoint{42.144082bp}{12.448187bp}}
\pgfpathcurveto{\pgfpoint{39.898511bp}{59.729929bp}}{\pgfpoint{31.914259bp}{104.391838bp}}{\pgfpoint{41.76982bp}{128.469348bp}}
\pgfpathcurveto{\pgfpoint{35.532123bp}{127.097055bp}}{\pgfpoint{19.064604bp}{128.344594bp}}{\pgfpoint{4.343639bp}{143.814082bp}}
\pgfclosepath
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{20.156201bp}{144.469041bp}}
\pgfpathcurveto{\pgfpoint{22.744845bp}{140.071464bp}}{\pgfpoint{21.372552bp}{136.4536bp}}{\pgfpoint{20.343332bp}{132.679793bp}}
\pgfpathcurveto{\pgfpoint{27.17361bp}{129.280249bp}}{\pgfpoint{31.446432bp}{128.812421bp}}{\pgfpoint{33.255364bp}{128.84361bp}}
\pgfpathcurveto{\pgfpoint{32.10139bp}{132.461474bp}}{\pgfpoint{32.475652bp}{134.675856bp}}{\pgfpoint{32.787537bp}{137.264501bp}}
\pgfpathcurveto{\pgfpoint{30.198893bp}{138.075401bp}}{\pgfpoint{25.489431bp}{139.073433bp}}{\pgfpoint{20.156201bp}{144.469041bp}}
\pgfclosepath
\color[rgb]{1.0,1.0,1.0}\pgfseteorule\pgfusepath{fill}
\pgfpathmoveto{\pgfpoint{20.156201bp}{144.469041bp}}
\pgfpathcurveto{\pgfpoint{22.744845bp}{140.071464bp}}{\pgfpoint{21.372552bp}{136.4536bp}}{\pgfpoint{20.343332bp}{132.679793bp}}
\pgfpathcurveto{\pgfpoint{27.17361bp}{129.280249bp}}{\pgfpoint{31.446432bp}{128.812421bp}}{\pgfpoint{33.255364bp}{128.84361bp}}
\pgfpathcurveto{\pgfpoint{32.10139bp}{132.461474bp}}{\pgfpoint{32.475652bp}{134.675856bp}}{\pgfpoint{32.787537bp}{137.264501bp}}
\pgfpathcurveto{\pgfpoint{30.198893bp}{138.075401bp}}{\pgfpoint{25.489431bp}{139.073433bp}}{\pgfpoint{20.156201bp}{144.469041bp}}
\pgfclosepath
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{416.499459bp}{161.030126bp}}
\pgfpathcurveto{\pgfpoint{418.994537bp}{145.934899bp}}{\pgfpoint{391.829368bp}{77.694496bp}}{\pgfpoint{420.148511bp}{40.892084bp}}
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{366.25481bp}{165.147006bp}}
\pgfpathcurveto{\pgfpoint{370.621198bp}{159.034063bp}}{\pgfpoint{372.367753bp}{151.424073bp}}{\pgfpoint{368.126119bp}{145.685391bp}}
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{387.026341bp}{167.673273bp}}
\pgfpathcurveto{\pgfpoint{389.864493bp}{163.805901bp}}{\pgfpoint{389.802116bp}{159.751398bp}}{\pgfpoint{387.961995bp}{156.164722bp}}
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{399.714409bp}{150.471577bp}}
\pgfpathcurveto{\pgfpoint{396.876257bp}{154.338949bp}}{\pgfpoint{398.997074bp}{157.364232bp}}{\pgfpoint{400.837194bp}{160.950908bp}}
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgftransformcm{1.0}{0.0}{0.0}{1.0}{\pgfpoint{148.434436bp}{90.668905bp}}
\pgftext[left,base]{\sffamily\mdseries\upshape\normalsize
\color[rgb]{0.0,0.0,0.0}$E = m c^2$}
\end{pgfscope}
\end{pgfpicture}
\end{document}


Eventually realize that what I ask is far more complex than I imagined

I realize why some of you ( gurus in TeX-TikZ) maybe you haven't responded to my question. Without much comment in following figure...problems of overlap has begining.......

(The figure isn't through code, but with editing in Gimp)

...addition 1 ...after the response of @PeterGrill

I show here some figures with a scale corresponding to both x-y, scale-x, scale-y (factor=2).

Here I have posted the jpgfdraw file which I use to experiment https://docs.google.com/open?id=0BxaG1GVbo3S5ZkJDbmMwYlROTUk

I think the red lines must somehow remain stable. And black points to make connections with curves that vary

At the moment I am trying to create the red curves through TikZ as shown in handmade figure but my skills in the TikZ does not help me. (I think maybe something good will come out from this ...maybe not) ...

I think the solution will not come out of one single piece of code but rather will be piece by piece...obviously you probably have some better ideas, I would really like to hear those, really I have stuck

-
You are using ConTeXt? It seems so from your question, but it is not clear at all... –  yo' Nov 5 '12 at 12:03
@tohecz No, I use Latex and I compiling with xelatex –  karathan Nov 5 '12 at 13:50
I think it's Papyrus 1 - 1 Karathan. You can scale down the papyrus and make the text optional. Would that be enough? –  percusse Nov 5 '12 at 14:34
@percusse Yes this is true but I was thinking something like this tex.stackexchange.com/questions/75129/… but on papyrus –  karathan Nov 5 '12 at 14:40

Well, here is a start. I am not too happy about how I computed the scaling factors, but should get you started until someone comes up with a better solution:

## Code:

\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}

\newcommand*{\XScale}{1.0}%
\newcommand*{\YScale}{1.0}%

\makeatletter
\let\OldPgfpoint\pgfpoint
\renewcommand{\pgfpoint}[2]{%
\pgfmathsetlength{\pgf@x}{\XScale*#1}%
\pgfmathsetlength{\pgf@y}{\YScale*#2}%
}%
\makeatother

\newlength{\NormalHeight}
\newlength{\NormalWidth}

\settoheight{\NormalHeight}{$\mathstrut$}
\settowidth{\NormalWidth}{$E = mc^2$}
\newcommand*{\Papyrus}[1]{%
\pgfmathsetmacro{\XScale}{0.20*\widthof{#1}/\NormalWidth}
\pgfmathsetmacro{\YScale}{0.20*\heightof{#1}/\NormalHeight}
\begin{pgfpicture}{0bp}{0bp}{420.849709bp}{179.390961bp}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{32.278702bp}{137.07737bp}}
\pgfpathcurveto{\pgfpoint{5.113533bp}{147.962151bp}}{\pgfpoint{26.937674bp}{155.673503bp}}{\pgfpoint{37.413107bp}{145.194173bp}}
\pgfpathcurveto{\pgfpoint{45.642968bp}{139.580246bp}}{\pgfpoint{46.640999bp}{127.003489bp}}{\pgfpoint{34.337142bp}{127.252997bp}}
\pgfpathcurveto{\pgfpoint{0.747145bp}{137.108558bp}}{\pgfpoint{-15.689186bp}{157.100377bp}}{\pgfpoint{34.150011bp}{161.778649bp}}
\pgfpathcurveto{\pgfpoint{103.887462bp}{161.404387bp}}{\pgfpoint{428.247698bp}{121.857389bp}}{\pgfpoint{415.897059bp}{164.398482bp}}
\pgfpathcurveto{\pgfpoint{404.575639bp}{186.604683bp}}{\pgfpoint{351.368085bp}{173.848593bp}}{\pgfpoint{370.704945bp}{159.720209bp}}
\pgfpathcurveto{\pgfpoint{403.140969bp}{148.211659bp}}{\pgfpoint{410.71977bp}{167.236634bp}}{\pgfpoint{387.453161bp}{167.766838bp}}
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{37.892612bp}{39.289968bp}}
\pgfpathcurveto{\pgfpoint{107.630063bp}{38.915706bp}}{\pgfpoint{431.990299bp}{-1.754077bp}}{\pgfpoint{419.63966bp}{40.787015bp}}
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{4.343639bp}{143.814082bp}}
\pgfpathcurveto{\pgfpoint{25.92607bp}{73.0786bp}}{\pgfpoint{7.462488bp}{43.387163bp}}{\pgfpoint{2.846592bp}{23.301779bp}}
\pgfpathcurveto{\pgfpoint{15.44674bp}{3.216395bp}}{\pgfpoint{48.631287bp}{-3.146055bp}}{\pgfpoint{42.144082bp}{12.448187bp}}
\pgfpathcurveto{\pgfpoint{39.898511bp}{59.729929bp}}{\pgfpoint{31.914259bp}{104.391838bp}}{\pgfpoint{41.76982bp}{128.469348bp}}
\pgfpathcurveto{\pgfpoint{35.532123bp}{127.097055bp}}{\pgfpoint{19.064604bp}{128.344594bp}}{\pgfpoint{4.343639bp}{143.814082bp}}
\pgfclosepath
\color[rgb]{1.0,1.0,1.0}\pgfseteorule\pgfusepath{fill}
\pgfpathmoveto{\pgfpoint{4.343639bp}{143.814082bp}}
\pgfpathcurveto{\pgfpoint{25.92607bp}{73.0786bp}}{\pgfpoint{7.462488bp}{43.387163bp}}{\pgfpoint{2.846592bp}{23.301779bp}}
\pgfpathcurveto{\pgfpoint{15.44674bp}{3.216395bp}}{\pgfpoint{48.631287bp}{-3.146055bp}}{\pgfpoint{42.144082bp}{12.448187bp}}
\pgfpathcurveto{\pgfpoint{39.898511bp}{59.729929bp}}{\pgfpoint{31.914259bp}{104.391838bp}}{\pgfpoint{41.76982bp}{128.469348bp}}
\pgfpathcurveto{\pgfpoint{35.532123bp}{127.097055bp}}{\pgfpoint{19.064604bp}{128.344594bp}}{\pgfpoint{4.343639bp}{143.814082bp}}
\pgfclosepath
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{20.156201bp}{144.469041bp}}
\pgfpathcurveto{\pgfpoint{22.744845bp}{140.071464bp}}{\pgfpoint{21.372552bp}{136.4536bp}}{\pgfpoint{20.343332bp}{132.679793bp}}
\pgfpathcurveto{\pgfpoint{27.17361bp}{129.280249bp}}{\pgfpoint{31.446432bp}{128.812421bp}}{\pgfpoint{33.255364bp}{128.84361bp}}
\pgfpathcurveto{\pgfpoint{32.10139bp}{132.461474bp}}{\pgfpoint{32.475652bp}{134.675856bp}}{\pgfpoint{32.787537bp}{137.264501bp}}
\pgfpathcurveto{\pgfpoint{30.198893bp}{138.075401bp}}{\pgfpoint{25.489431bp}{139.073433bp}}{\pgfpoint{20.156201bp}{144.469041bp}}
\pgfclosepath
\color[rgb]{1.0,1.0,1.0}\pgfseteorule\pgfusepath{fill}
\pgfpathmoveto{\pgfpoint{20.156201bp}{144.469041bp}}
\pgfpathcurveto{\pgfpoint{22.744845bp}{140.071464bp}}{\pgfpoint{21.372552bp}{136.4536bp}}{\pgfpoint{20.343332bp}{132.679793bp}}
\pgfpathcurveto{\pgfpoint{27.17361bp}{129.280249bp}}{\pgfpoint{31.446432bp}{128.812421bp}}{\pgfpoint{33.255364bp}{128.84361bp}}
\pgfpathcurveto{\pgfpoint{32.10139bp}{132.461474bp}}{\pgfpoint{32.475652bp}{134.675856bp}}{\pgfpoint{32.787537bp}{137.264501bp}}
\pgfpathcurveto{\pgfpoint{30.198893bp}{138.075401bp}}{\pgfpoint{25.489431bp}{139.073433bp}}{\pgfpoint{20.156201bp}{144.469041bp}}
\pgfclosepath
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{416.499459bp}{161.030126bp}}
\pgfpathcurveto{\pgfpoint{418.994537bp}{145.934899bp}}{\pgfpoint{391.829368bp}{77.694496bp}}{\pgfpoint{420.148511bp}{40.892084bp}}
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{366.25481bp}{165.147006bp}}
\pgfpathcurveto{\pgfpoint{370.621198bp}{159.034063bp}}{\pgfpoint{372.367753bp}{151.424073bp}}{\pgfpoint{368.126119bp}{145.685391bp}}
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{387.026341bp}{167.673273bp}}
\pgfpathcurveto{\pgfpoint{389.864493bp}{163.805901bp}}{\pgfpoint{389.802116bp}{159.751398bp}}{\pgfpoint{387.961995bp}{156.164722bp}}
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgfsetlinewidth{1.0bp}
\pgfsetrectcap
\pgfsetmiterjoin \pgfsetmiterlimit{10.0}
\pgfpathmoveto{\pgfpoint{399.714409bp}{150.471577bp}}
\pgfpathcurveto{\pgfpoint{396.876257bp}{154.338949bp}}{\pgfpoint{398.997074bp}{157.364232bp}}{\pgfpoint{400.837194bp}{160.950908bp}}
\color[rgb]{0.0,0.0,0.0}
\pgfusepath{stroke}
\end{pgfscope}
\begin{pgfscope}
\pgftransformcm{1.0}{0.0}{0.0}{1.0}{\pgfpoint{148.434436bp}{90.668905bp}}
\pgftext[left,base]{\sffamily\mdseries\upshape\normalsize
\color[rgb]{0.0,0.0,0.0}#1}
\end{pgfscope}
\end{pgfpicture}%
}

\begin{document}
\Papyrus{$E' = mc + m c^2 + m c^3$}
\Papyrus{$\displaystyle\frac{\displaystyle\sum_{n=1}^{\infty} = f(n)}{\displaystyle\sum_{n=1}^{\infty} = g(n)}$}
\end{document}

-
Thanks for the response , ...the first problems began to appear. However you skipped ahead one step :-) –  karathan Nov 7 '12 at 9:55
@karathan: Huh? Skipped ahead one step? –  Peter Grill Nov 7 '12 at 9:58
oh I used a wrong expression? .... my English not help me ... I apologize for this –  karathan Nov 7 '12 at 10:10
@karathan: No problem. I thought that perhaps you saw a problem with this answer. –  Peter Grill Nov 7 '12 at 10:13
the only certainty is that I will write error and other expressions ... my fault and google's translator... :-) .....the set of commands that you gave I definitely could not do it ..... and though the dodge will allow me here to say "thank you" :-) –  karathan Nov 7 '12 at 10:20