2

I have recently found a very nice example of how to create text boxes with a parchment-style layout:

http://www.texample.net/tikz/examples/framed-tikz/

Also, here on tex.stackexchange, there are numerous samples employing the framed package to produce this kind of layout.

However, in my document, I am already using the mdframed package to typeset a different kind of frame/box. Is it possible to produce such a layout using the mdframed package as well? If so - how?

Edit

I following the suggestion from Werner, I have played around a little and achieved the following:

\makeatletter
\usetikzlibrary{decorations.pathmorphing, patterns}
\renewrobustcmd*\mdf@tikzbox@tfl[1]{%three or four borders
    \path(0,0)rectangle(\mdfboundingboxwidth,\mdfboundingboxheight);% replace \clip by \path
    \begin{scope}[mdfcorners]%
       \clip[preaction=mdfouterline]%
            [postaction=mdfbackground]%
            [postaction=mdfinnerline]#1;%
    \end{scope}%
    \path[mdfmiddleline,mdfcorners]#1;
  }%
\newenvironment{parchment}[1][]{%
  \mdfsetup{%
    frametitlebackgroundcolor=none,
    innermargin=5pt,
    frametitleaboveskip=-\ht\strutbox,
    frametitlebelowskip=-\ht\strutbox,
    innertopmargin=10pt,
    innerbottommargin=10pt,
    tikzsetting={
      line width=2pt,orange!30!black!10, decorate, 
      decoration={random steps, segment length=2.5cm, amplitude=1.5mm}
    },
    everyline=false
  }
  \ifstrempty{#1}{%
    \mdfsetup{%
      frametitle={\fcolorbox{black}{white}{Handout}},
    }%
  }{%
    \mdfsetup{%
      frametitle={\fcolorbox{black}{white}{Handout: #1}},
    }%
  }%
  \begin{mdframed}[]
    \relax%
}{\end{mdframed}}
\makeatother

However, when I use everyline=true instead of everyline=false, the pagebreaks in my document change. Can anybody explain?

Edit 2

I have finally found some time to revisit this issue. Please have a look at this MWE:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{tikz}
\usepackage{etextools}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2cm,rmargin=3cm,marginparwidth=2.5cm,headheight=15pt}
\usepackage{emerald}

\let\fancyfont\ECFAugie

\makeatletter
\usetikzlibrary{decorations.pathmorphing, patterns}
\renewrobustcmd*\mdf@tikzbox@tfl[1]{%three or four borders
    \path(0,0)rectangle(\mdfboundingboxwidth,\mdfboundingboxheight);% replace \clip by \path
    \begin{scope}[mdfcorners]%
       \clip[preaction=mdfouterline]%
            [postaction=mdfbackground]%
            [postaction=mdfinnerline]#1;%
    \end{scope}%
    \path[mdfmiddleline,mdfcorners]#1;
  }%
\newenvironment{parchment}[1][]{%
  \mdfsetup{%
    frametitlebackgroundcolor=none,
    innermargin=5pt,
    frametitleaboveskip=-\ht\strutbox,
    frametitlebelowskip=-\ht\strutbox,
    innertopmargin=10pt,
    innerbottommargin=10pt,
    tikzsetting={
      line width=2pt,orange!30!black!10, decorate, 
      decoration={random steps, segment length=2.5cm, amplitude=1.5mm}
    },
    everyline=false
  }
  \ifstrempty{#1}{%
    \mdfsetup{%
      frametitle={\fcolorbox{black}{white}{Handout}},
    }%
  }{%
    \mdfsetup{%
      frametitle={\fcolorbox{black}{white}{Handout: #1}},
    }%
  }%
  \begin{mdframed}[]
    \relax%
}{\end{mdframed}}
\makeatother

\begin{document}
\begin{parchment}[Lorem ipsum]
\fancyfont
\lipsum[1-60]
\end{parchment}
\end{document}

Here's the list of issues that I would still like to resolve:

  • The frame borders are sometimes "chopped off". I think this is related to the bounding box/clipping of TikZ, but I don't know how to resolve it.

screenshot

  • I would like to give the whole thing a background image that is cropped precisely to the drawn border.

Additionally, it would be great if the baselines could be slightly curved and tilted to look more like handwritten script - but I guess I can figure out how to do this - perhaps like this: Cthulhu document

carsten
  • 2,966

0 Answers0