TransWikia.com

New line in column environment

TeX - LaTeX Asked on May 5, 2021

I am trying to use newline in the columns environment but it doesn’t seem to work. This is the minimum working code.

documentclass{beamer}
usetheme[progressbar=frametitle]{metropolis}
usefonttheme{serif}
setbeamertemplate{frame numbering}[fraction]
usepackage{tcolorbox}
usepackage{xcolor}
begin{document}
begin{frame}
frametitle{test}
begin{columns}
begin{column}{0.46textwidth}
begin{itemize}
item bloop
item foo
end{itemize}
end{column}
begin{column}{0.65textwidth}
    begin{itemize}
        item test
        begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,hbox]
                scriptsizetexttt{line1}
                scriptsizetexttt{line2}
        end{tcolorbox}
    end{itemize}
end{column}

end{columns}
end{frame}
end{document}

I am trying to get "line1" and "line2" in two separate lines. Could you please give me a hint on how to achieve this. Thanks in advance.

One Answer

Here are two different possibilities:

enter image description here

enter image description here

documentclass{beamer}
usetheme[progressbar=frametitle]{metropolis}
usefonttheme{serif}
setbeamertemplate{frame numbering}[fraction]
usepackage{tcolorbox}
usepackage{array}
usepackage{xcolor}
begin{document}
begin{frame}
frametitle{empty line between "line 1"  and "line 2" and without hbox}
begin{columns}
begin{column}{0.46textwidth}
begin{itemize}
item bloop
item foo
end{itemize}
end{column}
begin{column}{0.65textwidth}
    begin{itemize}
        item test
        begin{tcolorbox}[colback=red!5!white,colframe=red!75!black]
                scriptsizettfamily line1
                
                line2
        end{tcolorbox}
    end{itemize}
end{column}

end{columns}
end{frame}


begin{frame}
frametitle{with hbox and a tabular environment}
begin{columns}
begin{column}{0.46textwidth}
begin{itemize}
item bloop
item foo
end{itemize}
end{column}
begin{column}{0.65textwidth}
    begin{itemize}
        item test
        begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,hbox]
                begin{tabular}{@{}>{scriptsizettfamily}l@{}}
                  line1                 
                  line2
                end{tabular}
        end{tcolorbox}
    end{itemize}
end{column}

end{columns}
end{frame}
end{document}

Correct answer by leandriis on May 5, 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