Difference between revisions of "Framed"

From Wiki
Jump to navigation Jump to search
m (Back link to visuals)
(→‎Rounded Corners: Added example from core-rul)
Line 39: Line 39:
  
 
</context>
 
</context>
 +
 +
== Rounded Coreners ==
 +
 +
<cmd>framed</cmd> allows you to have round corners with <code>corner=round</code>. There are also other possibilities if you want round corners but not at all places by giving an appropriate number to <code>corner=...</code>. This example is taken from [[source:core-rul.tex | core-rul.tex]] and each frame is typeset using
 +
 +
<texcode>
 +
\framed[corener=....,frame=on]{...}
 +
</texcode>
 +
 +
<context>
 +
    \dontleavehmode\framed
 +
        [corner=0,frame=on,
 +
          ]{\tttf corner=
 +
\twodigits\recurselevel}%
 +
    \vskip1em
 +
    \dontleavehmode\dostepwiserecurse {1} {4}{1}{\framed
 +
        [corner=\recurselevel,frame=on]
 +
        {\tttf corner=\twodigits\recurselevel}%
 +
        \quad}
 +
    \vskip1em
 +
    \dontleavehmode\dostepwiserecurse {5} {8}{1}{\framed
 +
        [corner=\recurselevel,frame=on]
 +
        {\tttf corner=\twodigits\recurselevel}%
 +
        \quad}
 +
    \vskip1em
 +
    \dontleavehmode\dostepwiserecurse {1} {4}{1}{\framed
 +
        [corner=\recurselevel,frame=on]
 +
        {\tttf corner=\twodigits\recurselevel}%
 +
        \quad}
 +
    \vskip1em
 +
    \dontleavehmode\dostepwiserecurse {5} {8}{1}{\framed
 +
        [corner=\recurselevel,frame=on]
 +
        {\tttf corner=\twodigits\recurselevel}%
 +
        \quad}
 +
    \vskip1em
 +
    \dontleavehmode\dostepwiserecurse {9}{12}{1}{\framed
 +
        [corner=\recurselevel,frame=on]
 +
        {\tttf corner=\twodigits\recurselevel}%
 +
        \quad}
 +
    \vskip1em
 +
    \dontleavehmode\dostepwiserecurse{13}{16}{1}{\framed
 +
        [corner=\recurselevel,frame=on]
 +
        {\tttf corner=\twodigits\recurselevel}%
 +
        \quad}
 +
    \vskip1em
 +
    \dontleavehmode\dostepwiserecurse{17}{20}{1}{\framed
 +
        [corner=\recurselevel,frame=on]
 +
        {\tttf corner=\twodigits\recurselevel}%
 +
        \quad}
 +
    \vskip1em
 +
    \dontleavehmode\dostepwiserecurse{21}{24}{1}{\framed
 +
        [corner=\recurselevel,frame=on]
 +
        {\tttf corner=\twodigits\recurselevel}%
 +
        \quad}
 +
    \vskip1em
 +
    \dontleavehmode\dostepwiserecurse{25}{28}{1}{\framed
 +
        [corner=\recurselevel,frame=on]
 +
        {\tttf corner=\twodigits\recurselevel}%
 +
        \quad}
 +
 +
</context>
 +
 +
  
 
= Similar topics =
 
= Similar topics =

Revision as of 16:33, 10 January 2007

< Visuals |



TODO: the page devoted to all kinds of framed stuff (See: To-Do List)


How to achieve specific results

Preventing hyphenation

One can prevent hypenation inside a frame by passing nothypenated option to align. It is also a good idea to add verytolerant and strectch options.

\startcombination[2*1]
{\framed
   [width=5cm,
    align={flushleft}]
   {\input ward \endgraf}}
{flushleft}
{\framed
   [width=5cm,
    align={flushleft,nothyphenated,verytolerant}] % maybe also stretch
   {\input ward \endgraf}}
{flushleft,\crlf nothypenated, \crlf verytolerant}
\stopcombination

Specify the width no longer than needed

I want to specify the maximum width of a frame. If the size of the 

box is smaller than the maximum width, I want a tight box. This can be done using the autowidth=force option to framed.

\defineframed
   [tightframed][width=5cm,autowidth=force,align=middle]

\tightframed{Small}

\tightframed{A really really long line that is split at 5cm}

Rounded Coreners

\framed allows you to have round corners with corner=round. There are also other possibilities if you want round corners but not at all places by giving an appropriate number to corner=.... This example is taken from core-rul.tex and each frame is typeset using

 \framed[corener=....,frame=on]{...}


Similar topics