tcolorbox 문서: 머리와 몸 사이의 공간 방지

tcolorbox 문서: 머리와 몸 사이의 공간 방지

일부 명령을 문서화하는 데 사용하고 있는데 tcolorbox명령 설명 본문에 약간의 배경색을 넣고 싶습니다. 아래 MWE에서는 본문을 자체 tcolorbox에 값으로 래핑하여 표시합니다 colback.

다만, 머리와 몸통 사이의 여백을 제거하여 직접 연결되도록 하고 싶습니다. 나는 운없이 nobeforeafter및 s를 통해 상자를 조정해 보았습니다 .before/after skip

본문(및 서문의 키를 사용하여 생성한 tcolorbox before/after doc body)이 무언가에 싸여 있는 것 같지만 액세스하고 변경하는 방법을 모르겠습니다.

예

\documentclass{article}

\usepackage{tcolorbox}
\tcbuselibrary{documentation}

\tcbset{
    doc head={
        interior style={fill,color=blue!10},
        boxsep=2pt,
        after skip=0pt,
        nobeforeafter,
        %show bounding box,
    },
    before doc body={
        \begin{tcolorbox}[
            colback=blue!5,
            colframe=blue!5,
            arc=0pt,
            outer arc=0pt,
            before skip=0pt,
            nobeforeafter,
        ]
    },
    after doc body={\end{tcolorbox}},
}


\begin{document}

\begin{docCommand}
    {myCommand}
    {\marg{argument}}
    Some description of the command. Blah blah blah.
\end{docCommand}

\end{document}

답변1

문서 헤드는 4.1pt의 건너뛰기 이후 기본값을 갖는 tcolorboxa 내에 배치됩니다 . tcbraster다음을 사용하여 0pt로 설정 doc raster={raster after skip=0pt}한 다음 간격을 제거해야 합니다.

\documentclass{article}

\usepackage{tcolorbox}
\tcbuselibrary{documentation}

\tcbset{
    doc head={
        interior style={fill,color=blue!10},
        boxsep=2pt,
    },
    doc raster={raster after skip=0pt},
    before doc body={
        \begin{tcolorbox}[
            colback=blue!5,
            colframe=blue!5,
            arc=0pt,
            outer arc=0pt,
            before skip=0pt,
        ]
    },
    after doc body={\end{tcolorbox}},
}


\begin{document}

\begin{docCommand}
    {myCommand}
    {\marg{argument}}
    Some description of the command. Blah blah blah.
\end{docCommand}

\end{document}

산출

관련 정보