包含 tikzpicture 的列之间的垂直规则

包含 tikzpicture 的列之间的垂直规则

我想在两列之间绘制一条不间断的垂直线,其中一列包含 tikz 图片。我尝试了两种使用 parcolumns 包的方法。在第一种方法中,我使用 vrule 绘制垂直线。这会使 tikz 图片出现在下一页而不是指定的列中

\documentclass[10pt]{article}
\usepackage{color}
\usepackage{graphicx}
\usepackage[right=2cm]{geometry}
\usepackage[export]{adjustbox}
\usepackage{tikz}
\usepackage{parcolumns}
\usepackage{xcolor}
\usepackage{linegoal}

\begin{document} 


\begin{parcolumns}[colwidths={1=.4\textwidth,2=0.1\textwidth}]{3}
\colchunk{

 \begin{minipage}{\linewidth}
 \begin{tikzpicture}
 \node[inner xsep=0pt,text width=\linewidth, top color=blue,bottom color=blue!10]
 {\parbox[t]{\linewidth}{\raggedright \hspace{0.6cm}\\  \raggedright  \LARGE \textbf{This is the top.\\}\vspace{8cm} \small \raggedright  \hspace{0.5cm} This is the bottom.\\}}; 
\end{tikzpicture}
\end{minipage}
  }

\colchunk{
\begin{minipage}[t]{\linewidth}
\vrule  height \textheight
\end{minipage}
  }

\colchunk{

  }
\end{parcolumns}
\end{document}

在第二种方法中,我利用了 parcolumns 包的 rulebetween 选项。在 tikz 图片的顶部边框处,规则中有一个清晰可见的中断。 在此处输入图片描述

\documentclass[10pt]{article}
\usepackage{color}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{tikz}
\usepackage{parcolumns}
\usepackage{xcolor}
\usepackage{linegoal}



\begin{document} 

\begin{parcolumns}[colwidths={1=.4\textwidth},rulebetween=true]{2}
\colchunk{

\begin{minipage}{\linewidth}
\begin{tikzpicture}
\node[inner xsep=0pt,text width=0.9\linewidth, top color=blue,bottom color=blue!10]
{\parbox[t]{\linewidth}{\raggedright \hspace{0.6cm}\\  \raggedright \LARGE \textbf{This is the top.\\}\vspace{8cm} \small \raggedright  \hspace{0.5cm} This is the bottom.\\}}; 
 \end{tikzpicture}
 \end{minipage}
   }

 \colchunk{

  }
\end{parcolumns}

\end{document}

我将非常感激任何有关该方法的帮助。

答案1

在此处输入图片描述

\documentclass[10pt,twocolumn]{article}
\setlength\columnseprule{2pt}
\usepackage{color}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{xcolor}




\begin{document} 

\noindent
\begin{tikzpicture}
\node[inner xsep=0pt,text width=\linewidth, top color=blue,bottom color=blue!10]
{\parbox[t][\dimexpr\textheight-7pt]{\linewidth}{\raggedright \hspace{0.6cm}
 \LARGE \textbf{This is the top.}\par\vspace{\fill}
 \small \hspace{0.5cm} This is the bottom.\par}}; 
 \end{tikzpicture}


\end{document}

答案2

虽然问题不是很清楚。这个答案显示了如何将 放在tikzpicture带有 的文本段落旁边tcolorbox。两个元素由垂直实线分隔。左右部分的宽度可以用实际尺寸固定或按比例固定。此解决方案将用于不可破坏的盒子。

\documentclass[10pt]{article}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\begin{document} 

\lipsum[2]

\begin{tcolorbox}[enhanced, 
tikz upper, sidebyside,
righthand width=.5\linewidth, 
segmentation style={solid},
frame hidden,
boxsep=0pt,
colback=white,
right=0pt,
]
\path[fill=yellow,draw=yellow!75!red]
(0,0) circle (1cm);
\fill[red] (45:5mm) circle (1mm);
\fill[red] (135:5mm) circle (1mm);
\draw[line width=1mm,red]
(215:5mm) arc (215:325:5mm);
\tcblower
\lipsum[2]
\end{tcolorbox}

\end{document}

在此处输入图片描述

相关内容