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 am designing one page in which i need to write 3 mdframed side by side. but all three must be having same height.

  <mdframed1>   <mdframed2>  <mdframed3>

How can i implement this?

share|improve this question

2 Answers 2

Easy job with tcolorbox:

\documentclass{article}
\usepackage{tcolorbox}
\newtcbox{\mybox}[1][]{%
  nobeforeafter,
  colframe=gray,
  boxrule=0.5pt,
  minipage,
  width=0.3\linewidth,
  height=8cm,               %%% <--- change here
  arc=3pt,
  boxsep=0pt,
  #1
  }

\begin{document}

\noindent
\mybox[colback=cyan!20]{Some text}
\hfill
\mybox[colback=orange!20]{Some text}
\hfill
\mybox[colback=green!20]{Some text}

\end{document}

enter image description here

If you want to fit the contents within the box of specified height, look for fitbox option in tcolorbox (page 59, section 3.13)

share|improve this answer

You can place each mdframed inside a minipage of the desired width (in this way, you can place sevearl mdframes side-by-side); inside each mdframed you can use a \parbox (or another minipage) of the predefined height. In the example below I implement this idea using a command with a mandatory argument (for the contents of the mdframed) and an optional argument to pass options to mdframed, but of course, you can implement the idea in any other way that suits your needs:

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}

\newcommand\FixedHt[2][]{%
  \begin{minipage}[t]{.30\textwidth}
  \begin{mdframed}[roundcorner=5pt,#1]
  \parbox[t][8cm][t]{\linewidth}{#2}
  \end{mdframed}%
  \end{minipage}%
}

\begin{document}

\noindent\FixedHt[backgroundcolor=cyan!20]{Some text}\hfill\FixedHt[backgroundcolor=orange!20]{Some text}\hfill\FixedHt[backgroundcolor=green!20]{Some text}\par

\end{document}

enter image description here

share|improve this answer

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.