1

I am learning LaTeX and tcolorbox and trying to recreate the following table from a burger menu. I am unsure how to horizontally-center the text and change the size of the text inside the top and bottom sections of the tcolorbox to match the original. I also need to know how to set the dimensions of the tcolorbox. Any assistance is greatly appreciated. Thank you.

\documentclass[12pt]{article}
\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\usepackage{multicol}
\usepackage[margin={1cm,1cm}]{geometry}
\usepackage{xcolor}

\definecolor{black}{RGB}{0,0,0}
\definecolor{beige}{RGB}{254,248,241}


\begin{document}

\section{Colored boxes}


\includegraphics{image002.png}


\tcbset{
        enhanced,
        colback=black!5!beige,
        boxrule=1.5pt,
        colframe=black!75!black,
        fontupper=\large,
        fontlower=\small
       }

       \begin{tcolorbox}[title=CHEESE BURGER \$11.50 - \$14 DOUBLE,   
       lifted shadow={1mm}{-2mm}{3mm}{0.1mm}%
       {black!50!beige}]
       BLACKWOOD VALLEY ORGANIC GRASS FED BEEF PATTIE WITH SMOKED MOZZARELLA, AMERICAN CHEDDAR, KETCHUP \& MUSTARD
       \end{tcolorbox}



\end{document}

First image is an embedded jpeg, second is my attempt to render in tcolorbox

After some help and more tweaking it's looking closer:

update

updated code:


\documentclass[10pt]{article}
\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\usepackage{multicol}
\usepackage[margin={1cm,1cm}]{geometry}
\usepackage{xcolor}

\definecolor{black}{RGB}{0,0,0}
\definecolor{beige}{RGB}{254,248,241}


\begin{document}

\section{Colored boxes}


\includegraphics{image002.png}


\tcbset{
        enhanced,
        colback=black!5!beige,
        boxrule=1.5pt,
        colframe=black!75!black,
        arc=2mm,
        top=3mm,
        width=11.5cm,
        fonttitle=\Large
        }

       \begin{tcolorbox}[center title, title=CHEESE BURGER \$11.50 - \$14 DOUBLE,   
       lifted shadow={1mm}{-2mm}{3mm}{0.1mm}%
       {black!50!beige}]
       BLACKWOOD VALLEY ORGANIC GRASS FED BEEF PATTIE WITH SMOKED MOZZARELLA, AMERICAN CHEDDAR, KETCHUP \& MUSTARD
       \end{tcolorbox}



\end{document}

1 Answer 1

1

Just include the option center title, and the modified MWE is:

\documentclass[12pt]{article}
\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\usepackage{multicol}
\usepackage[margin={1cm,1cm}]{geometry}
\usepackage{xcolor}

\definecolor{black}{RGB}{0,0,0}
\definecolor{beige}{RGB}{254,248,241}


\begin{document}

\section{Colored boxes}



\tcbset{
        enhanced,
        colback=black!5!beige,
        boxrule=1.5pt,
        colframe=black!75!black,
        fontupper=\large,
        fontlower=\small
       }

       \begin{tcolorbox}[
center title,
title=CHEESE BURGER \$11.50 - \$14 DOUBLE,   
       lifted shadow={1mm}{-2mm}{3mm}{0.1mm}%
       {black!50!beige}]
       BLACKWOOD VALLEY ORGANIC GRASS FED BEEF PATTIE WITH SMOKED MOZZARELLA, AMERICAN CHEDDAR, KETCHUP \& MUSTARD
       \end{tcolorbox}



\end{document}

enter image description here

3
  • Thank you. I need to center the text inside the body as well. Is there a way to do this? It may happen naturally if I can make the text of the title larger too. I tried with fontupper=\large inside the tcbset but that didn't appear to work. I was also experimenting with trying to use \newline after "PATTIE WITH" but that doesn't appear to work with tcolorbox.
    – caston
    May 16, 2020 at 14:02
  • I used width=11.5cm, under the tcbset and now it looks closer: I will update the question.
    – caston
    May 16, 2020 at 14:29
  • 2
    @caston You can add before upper=\centering.
    – user194703
    May 16, 2020 at 19:05

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.