[texhax] Centering "framed box" between two columns

Jerry jerry at seibercom.net
Wed Jan 31 14:11:26 CET 2018


On Wed, 31 Jan 2018 06:23:09 -0600, Brian Dunn stated:

>On Tue, 30 Jan 2018 11:14:26 -0500
>Jerry <jerry at seibercom.net> wrote:
>
>> I write articles for a local newspaper. The format is one large
>> heading, then two columns with a text box inserted between the two
>> columns, approximately 1 inch from the start of the article text. The
>> box contains my picture and name.  
>
>
>Here is a solution using the flowfram package.  Adjustments may be made
>to the set the margins, size and location of the author frame, and size
>of the title.  The most tedious requirement is that a \framebreak must
>be placed in the document text at each point where the frame break
>changes. In this case, four will have to be placed, and the document
>must be recompiled between each change to determine where to place the
>next. If the layout or text is changed, the \framebreaks must be removed
>then replaced one at a time.
>
>---
>
>\documentclass{article}
>
>\usepackage{calc}
>
>% Adjust margin:
>\usepackage[margin=1in]{geometry}
>
>\usepackage{microtype}% Improves line breaks
>
>\usepackage{lipsum}
>
>\usepackage{flowfram}
>
>
>\pagestyle{empty}
>
>
>% To show the borders of the textarea and frames:
>\showtypeblocktrue
>\showframebboxtrue
>
>
>% For the author picture:
>\newlength{\authorwidth}
>\setlength{\authorwidth}{2in}
>
>\newlength{\authorheight}
>\setlength{\authorheight}{15\baselineskip}
>
>\newlength{\authorY}
>\setlength{\authorY}{25\baselineskip}
>
>
>% For the wider top and bottom sections of each column:
>\setlength{\columnsep}{2em}
>
>\newlength{\topbotwidth}
>\setlength{\topbotwidth}{.5\textwidth-.5\columnsep}
>
>\newlength{\topbotrightX}
>\setlength{\topbotrightX}{.5\textwidth+.5\columnsep}
>
>
>% For the narrower section with the picture in the middle:
>\newlength{\midcolumnsep}
>\setlength{\midcolumnsep}{\authorwidth+2\columnsep}
>
>\newlength{\midwidth}
>\setlength{\midwidth}{.5\textwidth-.5\midcolumnsep}
>
>\newlength{\midrightX}
>\setlength{\midrightX}{.5\textwidth+.5\midcolumnsep}
>
>
>% Heights:
>\newlength{\titleheight}
>\setlength{\titleheight}{4\baselineskip}
>
>\newlength{\midheight}
>\setlength{\midheight}{\authorheight+2\baselineskip}
>
>\newlength{\botheight}
>\setlength{\botheight}{\authorY-\baselineskip}
>
>\newlength{\topheight}
>\setlength{\topheight}{
>    \textheight-\titleheight-\authorheight-3\baselineskip-\botheight
>}
>
>
>
>% Author image:
>\newstaticframe{\authorwidth}{\authorheight}
>    {.5\textwidth-.5\authorwidth}{\authorY}[authorframe]
>
>% Title:
>\newstaticframe{\textwidth}{\titleheight}
>    {0pt}{\textheight-\titleheight}[titleframe]
>
>% Left colummn:
>\onecolumninarea{\topbotwidth}{\topheight}
>    {0pt}{\botheight+\midheight}% top
>
>\onecolumninarea{\midwidth}{\midheight}
>    {0pt}{\botheight}% mid
>
>\onecolumninarea{\topbotwidth}{\botheight}
>    {0pt}{0\baselineskip}% bot
>
>% Right column:
>\onecolumninarea{\topbotwidth}{\topheight}
>    {\topbotrightX}{\botheight+\midheight}% top
>
>\onecolumninarea{\midwidth}{\midheight}
>    {\midrightX}{\botheight}% mid
>
>\onecolumninarea{\topbotwidth}{\botheight}
>    {\topbotrightX}{0\baselineskip}%bot
>
>
>\begin{staticcontents*}{authorframe}
>\LARGE\centering
>The author
>\end{staticcontents*}
>
>
>% Notes:
>%
>% Adjust geometry margins, \titleheight, \columnsep, \authorwidth and
>% \authorheight, and \authorY.
>%
>% A \framebreak is required at each point where the frame width changes.
>% Since things move around each time one is added, the framebreaks must be
>% added one at a time, front to back, and the document must be recompiled
>% each time.
>%
>% To avoid extra horizontal space at a \framebreak,
>% connect the frame break to the previous
>% word, or use a percent comment at the end of the previous word and place 
>% the \framebreak on the next line.
>
>
>\begin{staticcontents*}{titleframe}
>\LARGE\centering
>The title
>\end{staticcontents*}
>
>
>\begin{document}
>
>    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus 
>elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur 
>dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, 
>vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant 
>morbi tristique senectus et netus et malesuada fames ac turpis egestas. 
>Mauris ut leo. Cras viverra metus rhoncus sem.\framebreak Nulla et lectus 
>vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor 
>gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, 
>nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi 
>dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor 
>semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, 
>accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci 
>dignissim rutrum.
>
>    Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. 
>Morbi auctor lorem non justo.\framebreak Nam lacus libero, pretium at, 
>lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan 
>bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi 
>ac orci et nisl hendrerit mollis. Suspendisse ut massa. Cras nec ante. 
>Pellentesque a nulla. Cum sociis natoque penatibus et magnis dis 
>parturient montes, nascetur ridiculus mus. Aliquam tincidunt urna. Nulla 
>ullamcorper vestibulum turpis. Pellentesque cursus luctus mauris.
>
>    Nulla malesuada porttitor diam. Donec felis erat, congue non, volutpat 
>at, tincidunt tristique, libero. Vivamus viverra fermentum felis. Donec 
>nonummy pellentesque ante. Phasellus adipiscing semper elit. Proin 
>fermentum massa ac quam. Sed diam turpis, molestie vitae, placerat a, 
>molestie nec, leo. Maecenas lacinia. Nam ipsum ligula, eleifend at, 
>accumsan nec, suscipit a, ipsum. Morbi blandit ligula feugiat magna. Nunc 
>eleifend consequat lorem. Sed lacinia nulla vitae enim. Pellentesque 
>tincidunt purus vel magna. Integer non enim. Praesent euismod nunc eu 
>purus. Donec bibendum quam in tellus. Nullam cursus pulvinar lectus. Donec 
>et mi. Nam vulputate metus eu enim. Vestibulum pellentesque felis eu massa.
>
>    Quisque ullamcorper placerat ipsum. Cras nibh. Morbi vel justo vitae 
>lacus tincidunt ultrices. Lorem ipsum dolor sit amet, consectetuer 
>adipiscing elit. In hac habitasse platea dictumst. Integer tempus convallis 
>augue. Etiam facilisis. Nunc elementum fermentum wisi. Aenean placerat. Ut 
>imperdiet, enim sed gravida sollicitudin, felis odio placerat quam, ac 
>pulvinar elit purus eget enim. Nunc vitae tortor.\framebreak Proin tempus 
>nibh sit amet nisl. Vivamus quis tortor vitae risus porta vehicula.
>
>    Fusce mauris. Vestibulum luctus nibh at lectus. Sed bibendum, nulla a 
>faucibus semper, leo velit ultricies tellus, ac venenatis arcu wisi vel 
>nisl. Vestibulum diam. Aliquam pellentesque, augue quis sagittis posuere, 
>turpis lacus congue quam, in hendrerit risus eros eget felis. Maecenas eget 
>erat in sapien mattis porttitor. Vestibulum porttitor. Nulla facilisi. Sed 
>a turpis eu lacus commodo facilisis. Morbi fringilla, wisi in dignissim 
>interdum,\framebreak justo lectus sagittis dui, et vehicula libero dui 
>cursus dui. Mauris tempor ligula sed lacus. Duis cursus enim ut augue. Cras 
>ac magna. Cras nulla. Nulla egestas. Curabitur a leo. Quisque egestas wisi 
>eget nunc. Nam feugiat lacus vel est. Curabitur consectetuer.
>
>    Suspendisse vel felis. Ut lorem lorem, interdum eu, tincidunt sit amet, 
>laoreet vitae, arcu. Aenean faucibus pede eu ante. Praesent enim elit, 
>rutrum at, molestie non, nonummy vel, nisl. Ut lectus eros, malesuada sit 
>amet, fermentum eu, sodales cursus, magna. Donec eu purus. Quisque 
>vehicula, urna sed ultricies auctor, pede lorem egestas dui, et convallis 
>elit erat sed nulla. Donec luctus. Curabitur et nunc. Aliquam dolor odio, 
>commodo pretium, ultricies non, pharetra in, velit. Integer arcu est, 
>nonummy in, fermentum faucibus, egestas vel, odio.
>
>    Sed commodo posuere pede. Mauris ut est. Ut quis purus. Sed ac odio. 
>Sed vehicula hendrerit sem. Duis non odio. Morbi ut dui. Sed accumsan risus 
>eget odio. In hac habitasse platea dictumst. Pellentesque non elit. Fusce 
>sed justo eu urna porta tincidunt. Mauris felis odio, sollicitudin sed, 
>volutpat a, ornare ac, erat. Morbi quis dolor.
>
>\end{document}


That works great. I do have one quick question. I have been using the "xcolor"
package with the "\colorbox" command to fill in the box around the text and
image. Is it possible to incorporate that into this script also? I tried a
couple of ways, but it failed.

Thanks again.

-- 
Jerry


More information about the texhax mailing list