tcolorbox 文本大小和水平居中

tcolorbox 文本大小和水平居中

我正在学习 LaTeX 和 tcolorbox,并尝试从汉堡菜单中重新创建下表。我不确定如何水平居中文本并更改 tcolorbox 顶部和底部部分内的文本大小以匹配原始文本。我还需要知道如何设置 tcolorbox 的尺寸。任何帮助都将不胜感激。谢谢。

\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}

第一张图片是嵌入的 jpeg,第二张图片是我尝试在 tcolorbox 中渲染的

经过一些帮助和更多调整后,它看起来更接近了:

更新

更新代码:


\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

只需包含选项center title,修改后的结果MWE是:

\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}

在此处输入图片描述

相关内容