Salve a tutti.
Ho lavorato al problema posto in questo thread e credo di essere arrivato ad una soluzione decente. Nel farlo ho ricevuto i consigli illuminanti di Claudio Beccari, che ringrazio. La soluzione che presento qui è senz’altro suscettibile di miglioramenti e modifiche future.
Premessa
Intanto, incollo un esempio di layout reale che mi interessa riprodurre:

Il problema in questione è uno di quelli che si risolve semplicemente con un impaginatore tipo Xquark, o simili altri programmi, cose professionali. Alternativamente si può provare con il freeware Scribus. Il mio scopo è di utilizzare LaTeX ed ho cercato una soluzione che non si servisse di strumenti “esterni”.
Soluzione
Ho creato l’ambiente:
`\longmedal[
ispirandomi al nome “medaglione” usato da Beccari nella guida a LaTeX distribuita da GuIT. L’ambiente longmedal si avvale del pacchetto xkeyval per il passaggio dei parametri. Un esempio è il seguente:
`
\definecolor{mylightgray}{rgb}{0.95,0.95,0.95}
%
\longmedal[%
width=1.1\textwidth, height=0.6\textheight,
topfraction=0.65,
innermargin=1.5cm,outermargin=0.2cm,
columns=1,
drawframe=true,drawsideframe=false,
framerule=2pt,frameheadrule=2.5em,framesep=2mm,
framecolor=darkgray,framebgcolor=mylightgray,
label={lmd:OneA}]%
{
Test testo testo testo …
}
`
Uno dei parametri più significativi è “height”: esso indica l’altezza complessiva del medaglione. Un altro parametro interessante è “columns”: ho voluto gestire anche un numero superiore a uno di colonne di testo avvalendomi del pacchetto multicols. Il significato degli altri parametri è intuitivo.
Incollo qui il risultato di due esempi di cui darò il codice più avanti:
esempio 1


esempio 2

L’algoritmo che divide il testo all’interno dell’ambiente e lo fa fluire nei diversi medaglioni è abbastanza semplice:
1. Si raccoglie tutto il “materiale”, cioè il testo, in una vbox.
2. Si comincia ad estrarre la parte alta della vbox con il comando
primitivo \vsplit di TeX di altezza prefissata (height).
3. Si utilizza un nuovo tipo di float (pacchetto float) con specificatore [t]
ed imponendo, tra le altre cose, topfraction=
topnumber = 1, bottomnumber=0, totalnumber=1.
4. Se l’altezza rimanente della vbox è ancora superiore a height
si riparte dal punto 2, altrimenti si applica il punto 3 alla vbox e
si finisce.
Per quanto riguarda l’altezza delle diverse scatole in cui è suddiviso il
testo ho scelto di adottare rigidamente un’altezza costante
e gestire il contenuto con delle \rule di LaTeX opportune
(si vedono passando l’opzione debug=true)
Per controllare la parità del numero di pagina ho usato il pacchetto
chngpage ( http://www.tex.ac.uk/cgi-bin/texfaq2html?label=oddpage ).
Codice
Allego il risultato del mio lavoro fino a questo punto.
`
% (c) 2007 Agostino De Marco
% Distributed freely. You can redistribute it freely.
\ProvidesFile{longmedal.sty}
\ProvidesPackage{longmedal}
\typeout{Package: `longmedal' v0.1\space <2007/11/23> (Agostino De Marco)}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{%
float,caption,geometry,multicol,ifthen,calc,
afterpage,
xkeyval,
color,
placeins,
chngpage% for \checkoddpage, \ifcpoddpage , http://www.tex.ac.uk/cgi-bin/texfaq2html?label=oddpage
}
%————————————————————
% the new float type
% http://www.guit.sssup.it/phpbb/viewtopic.php?t=1318&highlight=floatstyle
\newcommand\floatc@LMDfloatstyle[2]{{\@fs@cfont #1} #2\par}
\newcommand\fs@LMDfloatstyle{%
\def\@fs@cfont{\bfseries}%
\let\@fs@capt\floatc@ruled% \relax%
\let\@fs@capt\relax%
\def\@fs@pre{\relax}% {\hrule\kern2pt}%
\def\@fs@post{\relax}% {\vskip-5pt\hrule\kern2pt}% linea sotto
\def\@fs@mid{\relax}% {\kern2pt\hrule\kern2pt\vskip-2pt}%
%
\let\@fs@iftopcapt\iftrue% ensures caption position at top of float, superseeds \captionsetup
% \let\@fs@iftopcapt\iffalse% caption at bottom
%
% no caption at all, see caption.sty
\def\caption@@make##1##2{}%
}
\DeclareCaptionStyle{LMDfloatstyle}{labelfont=bf,labelsep=space,strut=off,position=top}
\captionsetup[LMDfloatstyle]{textfont=it,position=top,belowskip=0pt}
\floatstyle{%
LMDfloatstyle% other standard styles: plain, ruled, boxed
}
\newfloat{MedalFloat}{t}{lom}[chapter]
\floatname{MedalFloat}{Insight Box}
%————————————————————
% the name to be displayed in the heading
\newcommand{\LMDname}{\textsc{Insight Box}\ \theMedalFloat}
%————————————————————
% Box outer stuff: colors of frame and background, rule width, etc.
\newcommand*{\LMDframecolor}{black}
\newcommand*{\LMDframebgcolor}{gray}
\newlength{\LMDframesep} \setlength{\LMDframesep}{\fboxsep}
\newlength{\LMDframerule} \setlength{\LMDframerule}{\fboxrule}
\newlength{\LMDframeheadrule} \setlength{\LMDframeheadrule}{2em}
%————————————————————
% variables
\newcounter{LMDcolumns} \setcounter{LMDcolumns}{1}
\newcounter{LMD@columns} \setcounter{LMD@columns}{1}
\newlength{\LMDwidth} \setlength{\LMDwidth}{\textwidth}
\newlength{\LMDwidtha} \setlength{\LMDwidth}{\textwidth}
\newlength{\LMDwidthb} \setlength{\LMDwidth}{\textwidth}
\newlength{\LMDinnermargin} \setlength{\LMDinnermargin}{0.5cm}
\newlength{\LMDoutermargin} \setlength{\LMDoutermargin}{0.5cm}
\newlength{\LMDevenhoffset} \setlength{\LMDevenhoffset}{0cm}
\newlength{\LMDoddhoffset} \setlength{\LMDoddhoffset}{0cm}
\newlength{\LMDheightmax} \setlength{\LMDheightmax}{0.6\textheight}
\newlength{\LMDheight} \setlength{\LMDheight}{\LMDheightmax-\LMDframeheadrule-2\baselineskip}
\newlength{\lmd@dimena} \setlength{\lmd@dimena}{\z@}
\newcommand{\lmd@topfraction}{\topfraction}
\newcommand{\lmd@setfloatpar}{%
\renewcommand{\bottomfraction}{0.2}%
\setcounter{topnumber}{1}%
\setcounter{bottomnumber}{0}%
\setcounter{totalnumber}{1}%
}
%————————————————————————————-
% the main environment
%………………………………………………………….. xkeyval settings
% define a command \longmedal[key1=value1,key2=value2,…]{…}
% the parameters are set using xkeyval approach
\newdimen\@lmdinnermargin
\newdimen\@lmdoutermargin
\newdimen\@lmdframesep
\newdimen\@lmdframerule
\newdimen\@lmdframeheadrule
\newdimen\@lmdoddhoffset
\newdimen\@lmdevenhoffset
\define@key{lmd}{width}{\def\@lmdwidth{#1}
\setlength{\LMDwidth}{\@lmdwidth}}%
\define@key{lmd}{height}{\def\@lmdheight{#1}%
\setlength{\LMDheightmax}{\@lmdheight}}% <--- NB
\define@key{lmd}{topfraction}{\def\@lmdtopfraction{#1}
\renewcommand*{\topfraction}{\@lmdtopfraction}}%
\define@key{lmd}{textfraction}{\def\@lmdtextfraction{#1}
\renewcommand*{\textfraction}{\@lmdtextfraction}}%
\define@key{lmd}{bottomfraction}{\def\@lmdbottomfraction{#1}
\renewcommand*{\bottomfraction}{\@lmdbottomfraction}}%
\define@key{lmd}{columns}{\def\@lmdcolumns{#1}%
\setcounter{LMD@columns}{\@lmdcolumns}%
\setcounter{LMDcolumns}{\@lmdcolumns}%
}%
\define@key{lmd}{name}{\def\@lmdname{#1}
\renewcommand{\LMDname}{\@lmdname}}%
\define@key{lmd}{label}{\def\@lmdlabel{#1}}%
\define@key{lmd}{caption}{\def\@lmdcaption{#1}}%
\define@key{lmd}{innermargin}{\@lmdinnermargin=#1
\setlength{\LMDinnermargin}{\@lmdinnermargin}}%
\define@key{lmd}{outermargin}{\@lmdoutermargin=#1
\setlength{\LMDoutermargin}{\@lmdoutermargin}}%
\define@key{lmd}{oddhoffset}{\@lmdoddhoffset=#1
\setlength{\LMDoddhoffset}{\@lmdoddhoffset}}%
\define@key{lmd}{evenhoffset}{\@lmdevenhoffset=#1
\setlength{\LMDevenhoffset}{\@lmdevenhoffset}}%
\define@key{lmd}{framesep}{\def\@lmdframesep{#1}
\setlength{\LMDframesep}{\@lmdframesep}}%
\define@key{lmd}{framerule}{\def\@lmdframerule{#1}
\setlength{\LMDframerule}{\@lmdframerule}}%
\define@key{lmd}{frameheadrule}{\def\@lmdframeheadrule{#1}
\setlength{\LMDframeheadrule}{\@lmdframerule}}%
\define@key{lmd}{framecolor}{\def\@lmdframecolor{#1}
\renewcommand*{\LMDframecolor}{\@lmdframecolor}}%
\define@key{lmd}{framebgcolor}{\def\@lmdframebgcolor{#1}
\renewcommand*{\LMDframebgcolor}{\@lmdframebgcolor}}%
% ........................................................................
% boolean options
\newboolean{lmd@drawframe}\setboolean{lmd@drawframe}{false}
\newboolean{lmd@drawsideframe}\setboolean{lmd@drawsideframe}{false}
\newboolean{lmd@debug}\setboolean{lmd@debug}{false}
\newboolean{lmd@isodd}\setboolean{lmd@isodd}{false}
\define@boolkey{lmd}{drawframe}{%
\ifKV@lmd@drawframe
\setboolean{lmd@drawframe}{true}
\else
\setboolean{lmd@drawframe}{false}
\fi
}{%
\PackageWarning{longmedal}{erroneous input for drawframe, ignored}%
}
\define@boolkey{lmd}{drawsideframe}{%
\ifKV@lmd@drawsideframe
\setboolean{lmd@drawsideframe}{true}
\else
\setboolean{lmd@drawsideframe}{false}
\fi
}{%
\PackageWarning{longmedal}{erroneous input for drawsideframe, ignored}%
}
\define@boolkey{lmd}{debug}{%
\ifKV@lmd@debug
\setboolean{lmd@debug}{true}
\else
\setboolean{lmd@debug}{false}
\fi
}{%
\PackageWarning{longmedal}{erroneous input for debug, ignored}%
}
% ........................................................................
\newcommand{\longmedal}[2][]{%
%
% xkeyval related stuff
%
\def\@lmdwidth {}% treated as macro, not as a length
\def\@lmdheight {}% treated as macro, not as a length
\def\@lmdcolumns {}% treated as macro, not as a counter
\def\@lmdtopfraction {}%
\def\@lmdbottomfraction {}%
\def\@lmdtextfraction {}%
\def\@lmdname {}%
\def\@lmdcaption {}%
\def\@lmdlabel {}%
\def\@lmdframecolor {black}%
\def\@lmdframebgcolor {white}%
%
\@lmdframeheadrule=2em%\fboxrule
\@lmdframerule=0pt%\fboxrule
\@lmdframesep=\fboxsep%
\@lmdinnermargin=0pt%
\@lmdoutermargin=0pt%
\@lmdoddhoffset=0pt%
\@lmdevenhoffset=0pt%
%
% parse key-value arguments
%
\setkeys{lmd}{#1}%
%
% environment initial settings
%
% height
% having issued: \setlength{\LMDheightmax}{\lmd@height}
% i.e. the maximum height-wise length is that given by user...
%
\setlength{\LMDheight}{\LMDheightmax-\LMDframeheadrule
-\baselineskip
}
%
% width
\ifnum\value{LMD@columns}=1%
% single column
\setlength{\LMDwidtha}{\LMDwidth%
-2\@lmdframesep-2\@lmdframerule%
}% needs calc
\else
% multiple columns
\setlength{\LMDwidtha}{\LMDwidth%
-2\fboxsep-2\fboxrule%
-\value{LMD@columns}\columnsep+\columnsep%
-\value{LMD@columns}\columnseprule+\columnseprule%
}% needs calc
\fi
%
% the width of text to be splitted
\setlength{\LMDwidthb}{\LMDwidtha%
-\LMDinnermargin% some convenient margin
-\LMDoutermargin% some convenient margin
}% needs calc
%
\divide\LMDwidthb\value{LMD@columns}
%
% tweaks some float settings (could use \lmd@setfloatpar )
\renewcommand{\bottomfraction}{0.2}%
\setcounter{topnumber}{1}%
\setcounter{bottomnumber}{0}%
\setcounter{totalnumber}{1}%
%
%-------------------------------------------------------------------
% \LMDbox is the main box: it stores the environment ``material''
%
\setbox\LMDbox=\vbox\bgroup\hsize\LMDwidthb\noindent
#2
\par\egroup% this closes the main box: now it contains the ``material''
%
%-------------------------------------------------------------------
\setbox\LMDbox\vbox{\unvbox\LMDbox}% unbox in itself
%
%
% now the main macro: check for the height of \LMDbox and possibly split
% (NO RECURSION, while loop instead)
\lmd@makeboxes{}
}
\newboolean{@lmd@issplit} \setboolean{@lmd@issplit}{false}
\newcounter{@lmd@howmanychunks} \setcounter{@lmd@howmanychunks}{0}
\newlength{\lmd@filler}% used in last chunk if split occurred
\setlength{\lmd@filler}{0pt}
%\newsavebox{\LMDbox}
%\newsavebox{\LMDboxa}
%\newsavebox{\LMDboxb}
\newbox\LMDbox
\newbox\LMDboxa
\newbox\LMDboxb
\def\lmd@makeboxes#1{\relax
%
% stores the desired height of boxes in the float(s)
% Note 1: user might have set \topfraction by hand outside or inside the environment
% Note 2: user might have set \LMDheight by hand outside or inside the environment
%
%
% Main loop: strip off the top part of \LMDbox until the height of
% remaining part is less than the derired height of the float
%
%
%
\@whiledim\ht\LMDbox>\LMDheight%
\do{%
%
% we want to put the top part of \LMDbox in auxiliary boxes \LMDboxa and \LMDboxb
%
\ifnum\value{LMD@columns}>1%
\setbox\LMDboxa=\vsplit\LMDbox to \value{LMD@columns}\LMDheight%
%
\setbox\LMDboxb=\vtop{% <--- NB
%
\setlength{\linewidth}{\LMDwidth}% multicols balances column widths according to \linewidth
\begin{multicols}{\value{LMD@columns}}
\unvbox\LMDboxa
\end{multicols}
%
}%
\setbox\LMDboxa=\box\LMDboxb
\else
\setbox\LMDboxa\vsplit\LMDbox to \LMDheight%
%
\setbox\LMDboxa\vtop{% <--- NB
%
\unvbox\LMDboxa}% unbox in itself
\fi
%
% now put on page the material (contained in \box\LMDboxa)
%
% prevent changes in float counter when \LMDbox has been previously splitted
\ifthenelse{\boolean{@lmd@issplit}}{\addtocounter{MedalFloat}{-1}}{}%
%
\begin{MedalFloat}
\caption{MedalFloat. Chunk: \the@lmd@howmanychunks}%
\noindent%
%
% debug... \makebox[0pt][r]{\texttt{split \the@lmd@howmanychunks}\rule{0.3cm}{0pt}}%
%
\checkoddpage% needs chngpage, I guess it needs two latex passes
%
\if@twoside%
\ifcpoddpage% needs chngpage
%
% odd pages
%
\setboolean{lmd@isodd}{true}% set this global variable for external use
%
% repack the material in \box\LMDboxb
%
\setbox\LMDboxb\hbox{%
%
% put the main rule as a filler
\setlength{\lmd@dimena}{\LMDheightmax-\ht\LMDboxa}
\ifthenelse{\boolean{lmd@debug}}{\rule[-\lmd@dimena]{2pt}{\lmd@dimena}}{\rule[-\lmd@dimena]{0pt}{\lmd@dimena}}
%
\ifthenelse{\boolean{lmd@debug}}{\rule{\LMDinnermargin}{2pt}}{\rule{\LMDinnermargin}{0pt}}%
\box\LMDboxa%
\ifthenelse{\boolean{lmd@debug}}{\rule{\LMDoutermargin}{2pt}}{\rule{\LMDoutermargin}{0pt}}%
}%
%
% finally shipout the hbox into the frame
%
\centerline{\FrameCommand{\box\LMDboxb}}% do it at the end
\else%
%
% even page
%
\setboolean{lmd@isodd}{false}% set this global variable for external use
%
\setbox\LMDboxb\hbox{%
%
% put the main rule as a filler
\setlength{\lmd@dimena}{\LMDheightmax-\ht\LMDboxa}
\ifthenelse{\boolean{lmd@debug}}{\rule[-\lmd@dimena]{2pt}{\lmd@dimena}}{\rule[-\lmd@dimena]{0pt}{\lmd@dimena}}
%
\ifthenelse{\boolean{lmd@debug}}{\rule{\LMDoutermargin}{2pt}}{\rule{\LMDoutermargin}{0pt}}%
\box\LMDboxa%
\ifthenelse{\boolean{lmd@debug}}{\rule{\LMDinnermargin}{2pt}}{\rule{\LMDinnermargin}{0pt}}%
}%
%
% finally shipout the hbox into the frame
%
\centerline{\FrameCommand{\box\LMDboxb}}% do it at the end
\fi
\else%
%
% one side document
%
\setbox\LMDboxb\hbox{%
%
% put the main rule as a filler
\setlength{\lmd@dimena}{\LMDheightmax-\ht\LMDboxa}
\ifthenelse{\boolean{lmd@debug}}{\rule[-\lmd@dimena]{2pt}{\lmd@dimena}}{\rule[-\lmd@dimena]{0pt}{\lmd@dimena}}
%
\ifthenelse{\boolean{lmd@debug}}{\rule{\LMDinnermargin}{2pt}}{\rule{\LMDinnermargin}{0pt}}%
\box\LMDboxa%
\ifthenelse{\boolean{lmd@debug}}{\rule{\LMDoutermargin}{2pt}}{\rule{\LMDoutermargin}{0pt}}%
}%
%
% finally shipout the hbox into the frame
%
\centerline{\FrameCommand{\box\LMDboxb}}% do it at the end
\fi
%
\end{MedalFloat}
%
% flag the float as splitted
\ifdim\ht\LMDbox>0cm%
\setboolean{@lmd@issplit}{true}\fi
%
% update chunk count
\stepcounter{@lmd@howmanychunks}
%
}% end of while
%
\ifdim\ht\LMDbox>0cm
%
% nothing to split or last iteration
%
\ifthenelse{\boolean{@lmd@issplit}}%
{%
%
% prevent changes in float counter when \LMDbox has been previously splitted
%
\addtocounter{MedalFloat}{-1}%
}{}%
%
% show last chunk of material
%
\ifnum\value{LMD@columns}>1%
% ? \setbox\LMDboxa=\vsplit\LMDbox to \value{LMD@columns}\LMDheight
%
\setbox\LMDboxa=\vtop{% <--- NB
%
\setlength{\linewidth}{\LMDwidth}% multicols balances column widths according to \linewidth
%
\begin{multicols}{\value{LMD@columns}}
\unvbox\LMDbox% ..a
\end{multicols}
}%
%
\else
\setbox\LMDboxa\vtop{% <-- NB
\unvbox\LMDbox\par%
}%
\fi
\begin{MedalFloat}
\caption{MedalFloat. Chunk: \the@lmd@howmanychunks\ end}%
\noindent%
\checkoddpage% needs chngpage
\if@twoside%
\ifcpoddpage% needs chngpage
\setboolean{lmd@isodd}{true}% set this global variable for external use
\setbox\LMDboxb\hbox{%
%
% put the main rule as a filler
\setlength{\lmd@dimena}{\LMDheightmax-\ht\LMDboxa}
\ifthenelse{\boolean{lmd@debug}}{\rule[-\lmd@dimena]{2pt}{\lmd@dimena}}{\rule[-\lmd@dimena]{0pt}{\lmd@dimena}}
%
\ifthenelse{\boolean{lmd@debug}}{\rule{\LMDinnermargin}{2pt}}{\rule{\LMDinnermargin}{0pt}}%
\box\LMDboxa%
\ifthenelse{\boolean{lmd@debug}}{\rule{\LMDoutermargin}{2pt}}{\rule{\LMDoutermargin}{0pt}}%
}%
\centerline{\FrameCommand{\box\LMDboxb}}%
\else%
%
% even page
%
\setboolean{lmd@isodd}{false}% set this global variable for external use
\setbox\LMDboxb\hbox{%
%
% put the main rule as a filler
\setlength{\lmd@dimena}{\LMDheightmax-\ht\LMDboxa}
\ifthenelse{\boolean{lmd@debug}}{\rule[-\lmd@dimena]{2pt}{\lmd@dimena}}{\rule[-\lmd@dimena]{0pt}{\lmd@dimena}}
%
\ifthenelse{\boolean{lmd@debug}}{\rule{\LMDoutermargin}{2pt}}{\rule{\LMDoutermargin}{0pt}}%
\box\LMDboxa
\ifthenelse{\boolean{lmd@debug}}{\rule{\LMDinnermargin}{2pt}}{\rule{\LMDinnermargin}{0pt}}%
}%
%
% finally shipout the hbox into the frame (LAST CHUNK)
%
\centerline{\FrameCommand{\box\LMDboxb}}%
\fi
\else%
%
% one side document
%
\setbox\LMDboxb\hbox{%
\setlength{\lmd@dimena}{\LMDheightmax-\ht\LMDboxa}
\ifthenelse{\boolean{lmd@debug}}{\rule[-\lmd@dimena]{2pt}{\lmd@dimena}}{\rule[-\lmd@dimena]{0pt}{\lmd@dimena}}
\ifthenelse{\boolean{lmd@debug}}{\rule{\LMDinnermargin}{2pt}}{\rule{\LMDinnermargin}{0pt}}%
\box\LMDboxa%
\ifthenelse{\boolean{lmd@debug}}{\rule{\LMDoutermargin}{2pt}}{\rule{\LMDoutermargin}{0pt}}%
}%
% finally shipout the hbox into the frame (LAST CHUNK, ONESIDE)
\FrameCommand{\box\LMDboxb}
\fi
\end{MedalFloat}
\fi
%
% reset the split flag
%
\setboolean{@lmd@issplit}{false}
%
% reset the number of chunks
\setcounter{@lmd@howmanychunks}{0}
%
% set height pf box 0 to 0 after the last piece has been shipped out; the while do cycle ends
%
\ht\LMDbox=\z@%
}
%------------------------------------------------------------
% framing commands
%
% ref.: http://www.guit.sssup.it/phpbb/viewtopic.php?t=3186&start=15
\definecolor{lmd@blue}{rgb}{.4,.4,1}
\definecolor{lmd@lightblue}{rgb}{.8, .8, 1}
\definecolor{lmd@darkblue}{rgb}{0.07,0.08,0.4}
\definecolor{lmd@darkgreen}{rgb}{0.03,0.47,0.03}
\definecolor{lmd@lightgray}{rgb}{0.95,0.95,0.95}
\definecolor{lmd@darkgray}{gray}{.25}
\definecolor{lmd@violet}{rgb}{0.84,0,0.69}
\definecolor{lmd@orange}{cmyk}{0,0.61,0.87,0}
\definecolor{lmd@indigo}{cmyk}{0.8,0.9,0,0}
\definecolor{lmd@lightorange}{rgb}{.98,.75,.14}
\newlength\sidebarMyBox
\newlength\envruleMyBox
\newlength\envborderMyBox
\setlength\sidebarMyBox{1.5pt}% 1.5mm
\setlength\envruleMyBox{0.4pt}
\setlength\envborderMyBox{2.0mm}% A:2.5
\long\def\lmd@boxfboxs#1{%
\leavevmode
\setbox\@tempboxa\hbox{%
\color@begingroup
\kern\fboxsep{#1}\kern\fboxsep
\color@endgroup}%
\@frames@x\relax}
%
\def\@frames@x#1{%
\@tempdima\fboxrule
\advance\@tempdima\fboxsep
\advance\@tempdima\dp\@tempboxa
%
% hoffset
\ifthenelse{\boolean{lmd@isodd}}{\hspace{\LMDoddhoffset}}{\hspace{\LMDevenhoffset}}
%
\hbox{%
\lower\@tempdima\hbox{%
\vbox{%
%\hrule\@height\fboxrule
% agodemar …
\hrule height \LMDframeheadrule% 2.0em
%
\par
\makebox[0pt][l]{%
\raisebox{0.5\LMDframeheadrule-0.25\baselineskip}[0cm][0cm]{%
\ifthenelse{\boolean{@lmd@issplit}}{%
% @lmd@howmanychunks
\ifthenelse{\boolean{lmd@isodd}}{%
\textcolor{\LMDframecolor}{\ \LMDname}%
}{%
\textcolor{white}{\ \footnotesize (continua da pag. precedente)}%
}%
}{%
\textcolor{white}{\ \LMDname}%
}%
}%
}%
\par
\hrule height 0pt
% … agodemar
%
\hbox{%
\ifthenelse{\boolean{lmd@drawsideframe}}{\vrule\@width\LMDframerule}{}%
#1%
\vbox{%
%\vskip\fboxsep
\textcolor{\LMDframebgcolor}{\hrule height 2\LMDframesep}% a little tweak
\box\@tempboxa
\vskip\fboxsep}%
#1%
\ifthenelse{\boolean{lmd@drawsideframe}}{\vrule\@width\LMDframerule}{}%
}%
\ifthenelse{\boolean{lmd@drawframe}}{\hrule\@height\LMDframerule}{}%
}%
}%
}%
}
\def\lmd@boxfcolorbox#1#{\lmd@MyBoxcolor@fbox{#1}}
\def\lmd@MyBoxcolor@fbox#1#2#3{%
\color@b@x{\fboxsep\z@\color#1{#2}\lmd@boxfboxs}{\color#1{#3}}}
\def\FrameCommand{%
% Uncomment here to change globally these dimensions
\fboxrule=\the\sidebarMyBox%
%\fboxsep=\the\envborderMyBox%
\lmd@boxfcolorbox%
{\LMDframecolor}% border
{\LMDframebgcolor}% background
}%
% Provide configuration commands:
\providecommand\FrameCommand{\fboxrule=\FrameRule \fboxsep=\FrameSep \fbox}
\@ifundefined{FrameRule}{\newdimen\FrameRule \FrameRule=\fboxrule}{}
\@ifundefined{FrameSep} {\newdimen\FrameSep \FrameSep =3\fboxsep}{}
`
Ecco infine un esempio di documento:
`
\documentclass[12pt,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[italian]{babel}
\usepackage[latin1]{inputenc}
%————————————————
\usepackage{titlesec}
% pagestyle
\usepackage{calc}% needed here
\widenhead*{0pt}{\marginparsep + \marginparwidth} % symmetrically
\renewpagestyle{plain}{}
\newpagestyle{latexbook}[\bfseries]{
\headrule
\sethead%
[\thepage][][\chaptertitle]%
{\thesection\ \sectiontitle}{}{\thepage}
\setfoot[][][]{}{}{}
}
\pagestyle{latexbook}
%————————————————
\usepackage{amsmath,amsfonts}
\usepackage{framed,color,lipsum}
\usepackage{manfnt}
%\usepackage{graphicx,pstricks}
\usepackage{multicol}
\usepackage{lipsum}
%————————————————
% LONG MEDAL
\usepackage{longmedal}
%————————————————
\usepackage{afterpage}
\begin{document}
\mainmatter
\chapter{Gnats nel mondo}
{\hangindent=3pc\hangafter=-2\parindent=0pc
\makebox[0pt][r]{\makebox[3pc][l]{\dbend}}%
\lipsum[1]
}\medskip
{\hangindent=3pc\hangafter=-2\parindent=0pc
\makebox[0pt][r]{\makebox[3pc][l]{\dbend}}%
\lipsum[2]
}\medskip
{\hangindent=3pc\hangafter=-2\parindent=0pc
\makebox[0pt][r]{\makebox[3pc][l]{\dbend}}%
\lipsum[3]
}\medskip
\section{Gnu, questo sconosciuto}
\lipsum[1]\medskip
\afterpage{\clearpage\input{es_lm_1.tex}}
\lipsum[2]\medskip
\lipsum[3]\medskip
\lipsum[4]\medskip
\lipsum[5]\medskip
\lipsum[1]\medskip
\lipsum[2]\medskip
%—————————————————————————–
% see http://www.tex.ac.uk/cgi-bin/texfaq2html?label=floats
%
% si vogliono ristabilire i parametri “normali” degli oggetti floattanti
%
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\dbltopfraction}{.66}
\renewcommand{\dblfloatpagefraction}{.66}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
%—————————————————————————–
\lipsum\medskip
\lipsum\medskip
\lipsum[3]\medskip
\section{Gnome e i suoi fratelli}
\lipsum
\lipsum
\begin{figure}[tb]
\centering
\fbox{\rule{0pt}{0.35\textheight}\rule{0.5\textwidth}{0pt}}
\caption{Questa è una figura standard.}\label{fig:One}
\end{figure}
\lipsum
\begin{figure}[htb]
\centering
\fbox{\rule{0pt}{0.75\textheight}\rule{0.5\textwidth}{0pt}}
\caption{Questa è una figura standard.}\label{fig:Two}
\end{figure}
Oh, guarda che bella la \figurename~\ref{fig:One}!
Oh, guarda che bella la \figurename~\ref{fig:Two}!
%%%Oh, guarda che bella la \figurename~MF.\ref{fig:MF:One}!
%%%Oh, guarda che bella la \figurename~MF.\ref{fig:MF:Two}!
\chapter{Scopriamo il mondo di Gnome}
\section{L'ambiente di lavoro}
\lipsum\medskip
\lipsum[1]\medskip
\lipsum[2]\medskip
\lipsum[3]\medskip
\lipsum[4]\medskip
{\color{blue}AAA}\par
\afterpage{\clearpage\input{es_lm_2.tex}}
\lipsum\medskip
\lipsum\medskip
\lipsum\medskip
\lipsum\medskip
\lipsum\medskip
\lipsum
\end{document}
`
File es_lm_1.tex :
`
\definecolor{mylightgray}{rgb}{0.95,0.95,0.95}
\longmedal[%
debug=false,
width=1.1\textwidth,
innermargin=1.5cm,
outermargin=0.2cm,
height=0.60\textheight,
topfraction=0.65,
columns=1,
drawframe=true,
framerule=2pt,
%frameheadrule=2.5em,
%framesep=2mm,
framecolor=darkgray,
framebgcolor=mylightgray,
label={lmd:OneA}
]{%
{\bf\Large a}
\lipsum[1]\medskip
{\bf\Large b}
\lipsum[2]\medskip
{\bf\Large c}
\lipsum[3]\medskip
{\bf\Large d}
\lipsum[3]\medskip
{\bf\Large e}
\lipsum[4]\medskip
{\bf\Large f}
\lipsum[5]
}
`
File es_lm_2.tex :
`
\longmedal[
debug=false,
drawframe=true,
drawsideframe=true,
framerule=4pt,
framecolor=darkgray,
framebgcolor=yellow,
width=1.3\textwidth,
innermargin=2.5cm,
outermargin=0.2cm,
evenhoffset=1cm,oddhoffset=-1cm,
height={0.50\textheight},
topfraction=0.7,
columns=2,
label={lmd:One}
]{%
{\bf\Large a}
\lipsum[1]\medskip
{\bf\Large b}
\lipsum[2]\medskip
{\bf\Large c}
\lipsum[3]\medskip
{\bf\Large d}
\lipsum[4]\medskip
{\bf\Large e}
\lipsum[5]\medskip
{\bf\Large f}
\lipsum[6]
}
`
Per chi vuole provare, basta copiare e incollare…
Ciao,
Agostino