I asked the author of the framed
package, and his solution worked for me (although I do not really understand it):
\documentclass{article}
\usepackage{framed,color}
\definecolor{shadecolor}{rgb}{.9, .9, .9}
\makeatletter
\renewenvironment{snugshade}{%
\def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
\colorbox{shadecolor}{##1}\hskip-\fboxsep
% There is no \@totalrightmargin, so:
\hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
\MakeFramed {\advance\hsize-\width
\@totalleftmargin\z@ \linewidth\hsize
\@setminipage}}%
{\par\unskip\endMakeFramed}
\makeatother
\begin{document}
test a frame within an enumerate environment test a frame within an enumerate environment
\begin{enumerate}
\item abc
\begin{snugshade}
def
\end{snugshade}
\end{enumerate}
\end{document}
I do this in my reports. First you need the setup in your class or style file. In my case, it is our report class and it contains the following definitions for doing a govt SF-298 form:
\newenvironment{createSFtwoNINEeight}{
\clearpage
\begin{singlespace}
\begin{picture}(612,650)(70,82)
\includegraphics{SF298}
\footnotesize
\@SFitemONE{\@pubdate}
\@SFitemTWO{Final}
\@SFitemEIGHT{\@arlrptno}
\@SFitemTWELVE{\@distribution}
\def\SFitemSIXTEENaVALUE{Unclassified}
\def\SFitemSIXTEENbVALUE{Unclassified}
\def\SFitemSIXTEENcVALUE{Unclassified}
}{
\put(-564,100){\parbox[c]{0.8in}{\centering
\SFitemSIXTEENaVALUE}}
\put(-493,100){\parbox[c]{0.8in}{\centering
\SFitemSIXTEENbVALUE}}
\put(-422,100){\parbox[c]{0.8in}{\centering
\SFitemSIXTEENcVALUE}}
\normalsize
\end{picture}
\end{singlespace}
}
\newcommand\@SFitemONE[1]{\put(-564,662){#1}}
\newcommand\@SFitemTWO[1]{\put(-424,662){#1}}
\newcommand\SFitemTHREE[1]{\put(-217,662){#1}}
\newcommand\SFitemFOUR[1]{\put(-564,636){\parbox[t]{4.65in}{\raggedright#1}}}
\newcommand\SFitemFIVEa[1]{\put(-217,636){#1}}
\newcommand\SFitemFIVEd[1]{\put(-217,569){#1}}
\newcommand\SFitemSIX[1]{\put(-564,569){\parbox[t]{4.65in}{#1}}}
\newcommand\SFitemSEVEN[1]{\put(-564,485){\parbox[c]{4.65in}{\raggedright#1}}}
\newcommand\@SFitemEIGHT[1]{\put(-217,485){#1}}
\newcommand\SFitemNINE[1]{\put(-564,432){\parbox[c]{4.65in}{\raggedright#1}}}
\newcommand\SFitemTEN[1]{\put(-217,445){#1}}
\newcommand\SFitemELEVEN[1]{\put(-217,412){#1}}
\newcommand\@SFitemTWELVE[1]
{\put(-564,381){\parbox[c]{7.15in}{\setstretch{0.9}#1}}}
\newcommand\SFitemTHIRTEEN[1]{\put(-564,350){\parbox[t]{7.1in}{\raggedright#1}}}
\newcommand\SFitemFOURTEEN[1]{\put(-564,310){\parbox[t]{7.1in}{\raggedright#1}}}
\newcommand\SFitemFIFTEEN[1]{\put(-564,148){\parbox[b]{7.1in}{\raggedright#1}}}
\newcommand\SFitemSIXTEENa[1]{\def\SFitemSIXTEENaVALUE{#1}}
\newcommand\SFitemSIXTEENb[1]{\def\SFitemSIXTEENbVALUE{#1}}
\newcommand\SFitemSIXTEENc[1]{\def\SFitemSIXTEENcVALUE{#1}}
\newcommand\SFitemSEVENTEEN[1]{
\put(-352,108){\parbox[c]{0.8in}{\centering#1}}
}
\newcommand\SFitemEIGHTEEN[1]{\put(-285,108){\parbox[c]{0.8in}{\centering#1}}}
\newcommand\SFitemNINETEENa[1]{\put(-217,124){#1}}
\newcommand\SFitemNINETEENb[1]{\put(-217,100){#1}}
As you can see, it uses the native picture environment of LaTeX, in which it overlays your text on top of a blank form (the blank form is imported as a graphic). In your document, you then need to call on the environment to draw the picture:
%% OPTION I: CREATE YOUR OWN SF298 in LaTeX:
\begin{createSFtwoNINEeight}
% SFitemONE AUTOMATICALLY FILLED IN (\pubdate)
% SFitemTWO AUTOMATICALLY FILLED IN (Final)
\SFitemTHREE{January 2011-October 2011}
\SFitemFOUR{Frontiers in Anisotropic Shock-Wave Modeling}
\SFitemFIVEd{AH80}
\SFitemSIX{Alexander A. Lukyanov\\Steven B. Segletes}
\SFitemSEVEN{Abingdon [EDITED OUT]}
% SFitemEIGHT AUTOMATICALLY FILLED IN (\arlrptno)
% \SFitemNINE{As needed...}
% SFitemTWELVE AUTOMATICALLY FILLED IN (\distribution)
\SFitemTHIRTEEN{[EDITED OUT].}
\SFitemFOURTEEN{
Studies of anisotropic materials and the discovery of various novel and
unexpected phenomena under shock loading has contributed significantly
to our understanding of the behavior of condensed matter. The variety of
experimental studies for isotropic materials displays systematic
patterns, giving basic insights into the underlying physics of
anisotropic shock-wave modeling. There are many similarities and
significant differences in the phenomena observed for isotropic and
anisotropic materials under shock-wave loading. Despite this, the
anisotropic constitutive equations must represent, mathematically and
physically, the generalization of the conventional constitutive equations for
isotropic material and reduce to the conventional constitutive equations
in the limit of isotropy. This report presents the current state of the
art in the experimental and theoretical developments of this fascinating
field.
}
\SFitemFIFTEEN{anisotropic material, anisotropic
plasticity, shock waves, equation of state, stress decomposition}
% \SFitemSIXTEENa defaults to UNCLASSSIFIED
% \SFitemSIXTEENb defaults to UNCLASSSIFIED
% \SFitemSIXTEENc defaults to UNCLASSSIFIED
\SFitemSEVENTEEN{UU}
\SFitemEIGHTEEN{72}% = FRONT MATTER PP. + REPORT PP. + 2
\SFitemNINETEENa{Steven B. Segletes}
\SFitemNINETEENb{[EDITED OUT]}
\end{createSFtwoNINEeight}
The net result is
In response to the request for a self-contained example, I took the questioner's image at the top of this page, and saved it (as form.png). I then wrote this abbreviated snippet
\documentclass{article}
\usepackage{graphicx}
\usepackage{setspace}
\newenvironment{myForm}{
\clearpage
\begin{singlespace}
\begin{picture}(600,500)(70,82)
\includegraphics[height=9in]{form}
\footnotesize
\SFitemONE{\pubdate}
\SFitemEIGHT{\rptno}
}{
\normalsize
\end{picture}
\end{singlespace}
}
\newcommand\SFitemONE[1]{\put(-138,585){#1}}
\newcommand\SFitemEIGHT[1]{\put(-410,500){\textbf{#1}}}
\newcommand\SFitemSEVENTEEN[1]{
\put(-400,270){\parbox[c]{4.8in}{#1}}
}
\begin{document}
\def\pubdate{\today}
\def\rptno{xyz-123}
\begin{myForm}
\SFitemSEVENTEEN{This is the extended text This is the extended text
This is the extended text This is the extended text This is the
extended text This is the extended text This is the extended text }
\end{myForm}
\end{document}
The result is as follows, where a report number, a date, and an extended text section have been added to the user's form. In this example, I use both the environment to add data (\SFitemSEVENTEEN
) as well as using previously defined data (\pubdate
and \rptno
) within the form
Best Answer
Since you're already using
tikz
here's an example which makes use of overlays from that package. (See page 200 in the manual for more details). You do need to run this through LaTeX twice to get the placement to be correct.You could place the
tikzpicture
in a command\myborderedpage
and then call it on the pages where you want the border:If you're willing to load another
tikz
library, the following code is a bit simpler and less convoluted than the above examples: