将枚举中的 tcolorbox 与第一条基线对齐

将枚举中的 tcolorbox 与第一条基线对齐

我为此浪费了好几个小时……如何根据第一个基线(或某个 mm 的偏移)对齐一系列 tcolorbox。每个文档大约有 60 个这样的 tcolorbox,15 个文档……我需要修复!或者用其他方法获得相同的视觉效果

我拥有的:

\usepackage[most]{tcolorbox}
\tcbset{sharp corners, frame hidden, boxrule=0mm, colframe=white, box align=top}

稍后在文档中

\begin{enumerate}
\item \begin{tcolorbox}{(Proof 1.1) For $a$ and $b$, two elements of a Field $F$, using only the axioms for a field, proofs:}\end{tcolorbox}
\begin{itemize}
\item \openq $\forall a \in F$, $0a = 0$ \closeq

...

一定有办法……

灰色框需要与数字/项目符号旁边的第一行对齐

答案1

我建议使用这个 hack,方法如下enumitem

\documentclass[11pt, a4paper]{article}

\usepackage[utf8]{inputenc} %Character set
\usepackage{enumitem}
\usepackage[most]{tcolorbox}
\tcbset{sharp corners, frame hidden, boxrule=0mm, colframe=white, box align=top}
\newcommand{\openq}{\begin{tcolorbox}}
\newcommand{\closeq}{\end{tcolorbox}}

\makeatletter
\def\tcbboxsep{\kvtcb@boxsep}
\def\tcbtopsep{\kvtcb@topsep}
\makeatother

\begin{document}

\begin{enumerate}[nosep]
\item \leavevmode\vspace*{-\dimexpr2\baselineskip + \tcbboxsep + \tcbtopsep}
\begin{tcolorbox}{(Proof 1.1) For $a$ and $b$, two elements of a Field $F$, using only the axioms for a field, proofs:}\end{tcolorbox}
\begin{itemize}[nosep, wide=0pt, leftmargin=*]
\item \leavevmode\vspace*{-\dimexpr2\baselineskip + \tcbboxsep +\tcbtopsep}
\openq $\forall a \in F$, $0\,a = 0$ \closeq
\end{itemize}
\end{enumerate}

\end{document} 

在此处输入图片描述

相关内容