Text Formattingtwo frameboxes side by side

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
manflower
Posts: 4
Joined: Sat Jan 30, 2010 7:42 pm

two frameboxes side by side

Post by manflower »

Hi,

I tried placing two frameboxes side by side, but it did not work out. What I tried is:

Code: Select all

\begin{table}{cc}
\framebox{box1} & \framebox{box2 
\begin{enumerate}
\item box2-item1
\item box2-item2
\end{enumerate}
}
\end{tabular}
it seems like enumerate cannot happen inside a table or a framebox. Is there a way to enclose two boxes of text (with possible lists and so on) side by side with a frame (and make the spacing look natural too)?

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

manflower
Posts: 4
Joined: Sat Jan 30, 2010 7:42 pm

Re: two frameboxes side by side

Post by manflower »

Please note I had a typo, it should be \begin{tabular}...
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

two frameboxes side by side

Post by gmedina »

Hi,
manflower wrote:...it seems like enumerate cannot happen inside a table or a framebox...
It can, but you will have to enclose it using a \parbox.
manflower wrote:...Is there a way to enclose two boxes of text (with possible lists and so on) side by side with a frame (and make the spacing look natural too)?
depending on your intent, this can be achieved in several ways; the following example code shows two possible solutions:

Code: Select all

\documentclass{article}
\usepackage{enumitem}
\usepackage{framed}
\usepackage{multicol}
\usepackage{lipsum}% just to generate some text

\begin{document}

% using a tabular with \parbox inside \framebox
\noindent\begin{tabular}{p{.45\textwidth}p{.45\textwidth}}
\framebox{\parbox[t]{.4\textwidth}{\lipsum[1]}} & \framebox{\parbox[t]{.4\textwidth}{
  \lipsum[1] 
  \begin{enumerate}[nolistsep]
   \item box2-item1
   \item box2-item2
   \item box2-item3
  \end{enumerate}}}
\end{tabular}

\newpage

% now, using multicol and framed
\begin{multicols}{2}
\begin{framed}
\lipsum[1]
\end{framed}
\begin{framed}
\lipsum[1]
  \begin{enumerate}[nolistsep]
    \item box2-item1
    \item box2-item2
    \item box2-item3
  \end{enumerate}
\end{framed}
\end{multicols}

\end{document}
Please refer to the documentation of the used packages.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply