减少 tcolorbox 周围的边距

减少 tcolorbox 周围的边距

如何让文本与轮廓之间的间距最小tcolorbox:

在此处输入图片描述

我想知道如何调整这个红色的间距。谢谢!

代码

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\advance\topmargin-1in
\advance\textheight3in
\advance\textwidth3in
\advance\oddsidemargin-1.5in
\advance\evensidemargin-1.5in
\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}

\begin{document}

\begin{multicols*}{3}

\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,
  title=#2,colback=white}

%%------------ AM: Double Sideband Large Carrier ---------------
\hspace*{0.07cm}
\begin{minipage}{0.30\textwidth}

    \begin{mybox}{AM: Double Sideband Large Carrier [DSB-LC\text{]}}
\lipsum[2]

    \end{mybox}
\end{minipage}

\end{multicols*}
\end{document}

答案1

一种可能性是使用参数调整左边距left=2pt,使用参数调整右边距right=2pt

产生的结果:

彩色盒子

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\advance\topmargin-1in
\advance\textheight3in
\advance\textwidth3in
\advance\oddsidemargin-1.5in
\advance\evensidemargin-1.5in
\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}

\begin{document}

\begin{multicols*}{3}

\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,left=2pt,right=2pt,
  title=#2,colback=white}

%%------------ AM: Double Sideband Large Carrier ---------------
\hspace*{0.07cm}
\begin{minipage}{0.30\textwidth}

    \begin{mybox}{AM: Double Sideband Large Carrier [DSB-LC\text{]}}
\lipsum[2]

    \end{mybox}
\end{minipage}

\end{multicols*}
\end{document}

答案2

你可以像这样使用leftright

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\advance\topmargin-1in
\advance\textheight3in
\advance\textwidth3in
\advance\oddsidemargin-1.5in
\advance\evensidemargin-1.5in
\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}

\begin{document}

\begin{multicols*}{3}

\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,
  title=#2,colback=white, left=4pt, right=2pt}

%%------------ AM: Double Sideband Large Carrier ---------------
\hspace*{0.07cm}
\begin{minipage}{0.30\textwidth}

    \begin{mybox}{AM: Double Sideband Large Carrier [DSB-LC\text{]}}
\lipsum[2]

    \end{mybox}
\end{minipage}

\end{multicols*}

\end{document} 

在此处输入图片描述

相关内容