![减少 tcolorbox 周围的边距](https://linux22.com/image/385168/%E5%87%8F%E5%B0%91%20tcolorbox%20%E5%91%A8%E5%9B%B4%E7%9A%84%E8%BE%B9%E8%B7%9D.png)
如何让文本与轮廓之间的间距最小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
你可以像这样使用left
和right
:
\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}