如何在一段文字前排版双竖线?

如何在一段文字前排版双竖线?

我想问一下如何在一段文字前排版双竖线,如图所示:在此处输入图片描述

多谢 !

答案1

我喜欢 Skillmon 使用 tabularx 的解决方案。但这里还有另外两种方法。

\documentclass{article}

\usepackage{lipsum}

\usepackage{tikz}
\usetikzlibrary{calc, tikzmark}


\usepackage{framed}
\newlength{\leftbarwidth}
\setlength{\leftbarwidth}{1pt}
\newlength{\leftbarsep}
\setlength{\leftbarsep}{.5em}

\newenvironment{doubleleftbar}{%
    \def\FrameCommand{{\vrule width \leftbarwidth\hspace{2pt}\vrule width \leftbarwidth\relax\hspace
    {\leftbarsep}}}%
    \MakeFramed {\advance \hsize -\width \FrameRestore }%
}{%
    \endMakeFramed
}

\begin{document}

\begin{doubleleftbar}
\lipsum[1]
\end{doubleleftbar}


\noindent
\tikzmark{m1}The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.\tikzmark{m2}


\begin{tikzpicture}[overlay, remember picture]
\node[anchor=base] (a) at (pic cs:m1) {\vphantom{a}}; 
\node[anchor=base] (b) at (pic cs:m2) {\vphantom{a}};  
\begin{scope}[transform canvas={xshift = -\marginparsep-2\leftbarwidth-6pt}]
\draw [line width = \leftbarwidth]
     (a.north -| {pic cs:left}) -- (b.south -| {pic cs:left}) ;
\draw [line width = \leftbarwidth]
     ($(a.north -| {pic cs:left}) - (3pt, 0)$) -- ($(b.south -| {pic cs:left}) - (3pt, 0)$) ;
\end{scope}
\end{tikzpicture}

\end{document}

相关内容