Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have two paragraphs of instructions and I need to indicate to readers that they have a choice of one or another. I am using this code, to put the data into different columns, with a line between:

\startcolumns[n=2, rule=on]
    \startlines
        This is some instructions.
    \stoplines
    \column
    \startlines
        This is some other instructions.
    \stoplines
\stopcolumns

This makes a document like this, with a nice divide line in the middle:

 _______________________________
|                               |
| This is some  : This is some  |
| instructions. : other instru- |
|               : ctions.       |
|                               |
|_______________________________|

I'd like to add the text "or", beween the two columns, to make it more clear that readers have a choice. This breaks the divide line and appears exactly in the middle, centered vertically on the line, and horizontally centered as well, e.g.:

 _______________________________
|                               |
| This is some  :  This is some |
| instructions. or other instr- |
|               :  uctions.     |
|                               |
|_______________________________|

How can I add "or" text to the line dividing the two columns?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

There isn't any inbuilt command do add text to the column rule. Assuming that you are only interested in two column text that do not break across pages, you can fake two column text using low-level TeX and add a frame using metapost.

\defineframed
  [fakecolumn]
  [location=top,
   width=0.45\textwidth,
   align=normal,
   frame=off]

\defineframed
    [ORcolumn]
    [location=top,
     height=\ORcolumnht,
     width=2.5em,
     frame=off,
     background=ORcolumn,
     top=\vss,
     bottom=\vss]

\defineoverlay[ORcolumn][\useMPgraphic{ORcolumn}]

\startuseMPgraphic{ORcolumn}
  ht := 2*StrutHeight;
  draw (OverlayWidth/2, OverlayHeight/2-ht/2) -- (OverlayWidth/2, 0);
  draw (OverlayWidth/2, OverlayHeight/2+ht/2) -- (OverlayWidth/2, OverlayHeight);

  setbounds currentpicture to boundingbox OverlayBox;
\stopuseMPgraphic

\newbox\leftcolumnbox   \newbox\rightcolumnbox
\newdimen\ORcolumnht

\def\startORcolumns#1\column#2\stopORcolumn
    {\blank
     \setbox\leftcolumnbox \hbox{\fakecolumn{#1}}%
     \setbox\rightcolumnbox\hbox{\fakecolumn{#2}}%
     % location=top sets the ht of the box to structheight
     % and depth to the remaining length
     \ORcolumnht=\dimexpr\strutheight+
         \dp\ifdim\dp\leftcolumnbox>\dp\rightcolumnbox\leftcolumnbox\else\rightcolumnbox \fi
    \hbox to \textwidth
      {\hss\copy\leftcolumnbox
       \hss\ORcolumn{OR}\hss
       \copy\rightcolumnbox\hss}%
      \blank}



\starttext
\input zapf
\startORcolumns
  \input knuth
  \column
  \input ward
\stopORcolumn
\input zapf
\stoptext

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.