측면 테두리를 만드는 방법은 무엇입니까?

측면 테두리를 만드는 방법은 무엇입니까?

MWE는 다음과 같습니다.

\tcbox[enhanced,frame hidden,borderline={0.5pt}{0pt}{red,dashed}]{ab}

결과는 다음과 같습니다.
여기에 이미지 설명을 입력하세요

왼쪽 테두리만 나타나기를 원합니다. 것이 가능하다?
감사합니다!

답변1

borderline west이에 대한 옵션을 사용할 수 있습니다 .

\documentclass{article}
\usepackage{kantlipsum}         % for sample text
\usepackage{tcolorbox}
\tcbuselibrary{skins}

\newtcbox{\mybox}[1][]{
   enhanced, frame hidden, borderline west = {0.5pt}{0pt}{red,dashed}, #1
}

% Variant using a `minipage`-style boxing technique (this allows
% multiple lines, \tcblower, etc.)
\newtcolorbox{myleftlinebox}[1][]{
   enhanced, frame hidden, borderline west = {0.5pt}{0pt}{red,dashed}, #1
}

\begin{document}

This is \mybox{the box} and what comes next.

\bigskip
This is \mybox[on line]{the same box but \texttt{on line}} and what comes
next.

\bigskip \noindent
Variant based on \verb|\newtcolorbox|:
\begin{myleftlinebox}
  \kant[1]
\end{myleftlinebox}

\end{document}

스크린샷

이전 예는 로 선언된 스타일을 사용하여 제외할 수 있습니다 \tcbset. 예를 들면 다음과 같습니다.

\documentclass{article}
\usepackage{kantlipsum}         % for sample text
\usepackage{tcolorbox}
\tcbuselibrary{skins}

\tcbset{my left line/.style={
          enhanced, frame hidden, borderline west = {0.5pt}{0pt}{red,dashed}
}}

\newtcbox{\mybox}[1][]{my left line, #1}
\newtcolorbox{myleftlinebox}[1][]{my left line, #1}

\begin{document}

This is \mybox{the box} and what comes next.

\bigskip
This is \mybox[on line]{the same box but \texttt{on line}} and what comes
next.

\bigskip \noindent
Variant based on \verb|\newtcolorbox|:
\begin{myleftlinebox}
  \kant[1]
  \tcblower
  \kant[2]
\end{myleftlinebox}

\end{document}

스크린샷

관련 정보