3

I want to create page with two columns with different background color and height of whole page. What I was able to do is two columns with different background color but I can't set proper height and there is small gap between two columns and another gap between top of the page and top of the columns. I want to remove these gaps. Also I want to create vertical line between two columns. Right now I have minipages packed inside \colorbox which allows me to create all four borders but I only want one.

Final effect should look like this:

Final effect

This is what I figured out for now:

\documentclass{article}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{geometry}
\geometry{margin=0in}

\begin{document}
\noindent
\fcolorbox{black}{red}{
\begin{minipage}{.3\textwidth}
  test
\end{minipage}
}
\fcolorbox{yellow}{yellow}{
\begin{minipage}{.7\textwidth}
  test
\end{minipage}
}
\end{document}
1

If there should be nothing else than a splitted background, this can be done with tcolorbox package quite easily.

\documentclass{article}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{geometry}
\usepackage[most]{tcolorbox}
\geometry{margin=0pt}

\newtcolorbox{bgbox}[1][]{nobeforeafter,leftright skip=0pt,boxrule=0pt,enhanced jigsaw,sharp corners,#1}

\begin{document}
\noindent
\begin{bgbox}[height=\paperheight,colback=red,width=0.3\textwidth,rightrule=10pt,colframe=black]
\end{bgbox}%
\begin{bgbox}[height=\paperheight,colback=yellow,width=0.7\textwidth]
\end{bgbox}
\end{document}

enter image description here

  • That's almost exactly what I wanted. I would like there to be a vertical line splitting page between two columns. Is it possible to create one with solution you've proposed? Possibility to draw right border of left column or left border of right column would be perfect. – wwwww May 23 '16 at 8:25
  • @blaballong: Yes, of course. Say rightrule=2pt (or whatever size) for the left box or leftrule=2pt (etc) for the right box. See the updated code,please, but I did not update the screen shot – user31729 May 23 '16 at 8:57
  • @blaballong: You're welcome. I forgot to mention colframe=black, the default colour for the frame is some dark grey. – user31729 May 23 '16 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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