![将枚举中的 tcolorbox 与第一条基线对齐](https://linux22.com/image/381877/%E5%B0%86%E6%9E%9A%E4%B8%BE%E4%B8%AD%E7%9A%84%20tcolorbox%20%E4%B8%8E%E7%AC%AC%E4%B8%80%E6%9D%A1%E5%9F%BA%E7%BA%BF%E5%AF%B9%E9%BD%90.png)
我为此浪费了好几个小时……如何根据第一个基线(或某个 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}