TransWikia.com

How to align boxes in two column mode

TeX - LaTeX Asked on January 24, 2021

I am using two columns as follows:

documentclass{beamer}
beamertemplatenavigationsymbolsempty
setbeamersize{text margin left=10mm,text margin right=5mm} 
setbeamertemplate{frametitle}[default][center]
usepackage[many]{tcolorbox}

usepackage{calc}

begin{document}
begin{frame}[fragile]
begin{tcolorbox}[text width=textwidth-1cm, text height=2.5cm]{}

end{tcolorbox}

begin{columns}
begin{column}{0.4textwidth}

    begin{tcolorbox}[top=0pt, left=5pt,right=5pt, colback=blue!5!white, text width=4.7cm, text height=4.3cm]

end{tcolorbox}
end{column}
begin{column}{0.6textwidth}
setbeamertemplate{itemize item}[circle]

begin{itemize}
item Quis autem vel eum iure reprehenderit qui 
item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod  v
item Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium 
end{itemize}
end{column}
end{columns}
end{frame}

end{document}

enter image description here

How can I:

  • Line up the left hand edges of the boxes
  • Make as much room as possible for the right hand column but not have the bullet circles too close to the box?

One Answer

By default, columns environment is wider than regular text. If you want to use one column and two columns environments in one slide, you can add option onlytextwidth to columns declaration, like in following example. Another solution would be to declare the one column fragment inside a columns environment, this way both would use similar width.

In you tcolorboxes you make a mistake fixing text width. This parameter is no the width of the total box, but the width of the text inside it. Therefore your boxes are wider than expected. This is the reason for items dots appearing over the left box. Default total width of tcolorboxes is all the available textwidth.

documentclass{beamer}
beamertemplatenavigationsymbolsempty
setbeamersize{text margin left=10mm,text margin right=5mm} 
setbeamertemplate{frametitle}[default][center]
usepackage[many]{tcolorbox}

usepackage{calc}

begin{document}

begin{frame}[fragile]
begin{tcolorbox}[text height=2.5cm]{}

end{tcolorbox}

begin{columns}[onlytextwidth]
begin{column}{0.4textwidth}

begin{tcolorbox}[top=0pt, left=5pt,right=5pt, colback=blue!5!white, text height=4.3cm]

end{tcolorbox}
end{column}
begin{column}{0.6textwidth}
setbeamertemplate{itemize item}[circle]

begin{itemize}
item Quis autem vel eum iure reprehenderit qui 
item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod v
item Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium 
end{itemize}
end{column}
end{columns}
end{frame}

end{document}

enter image description here

Correct answer by Ignasi on January 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP