我正在尝试为我的两列书籍类自定义列分隔符。我做了一条简单的Tikz
线放在它们之间,但我找不到这样做的方法。这是我的代码的 MWE(我正在编译它,LuaLaTeX
因为我希望稍后使用一些其他功能):
\documentclass[12pt,a5paper,twocolumn,twoside]{book}
\usepackage{geometry}
\geometry{
paper = a5paper,
layout = a5paper,
layoutsize = {148 mm, 210 mm},
includehead = true,
includefoot = true,
inner = 1.5 cm,
outer = 1 cm,
top = 1.5 cm,
bottom = 1.5 cm,
columnsep = .6cm,
twoside = true,
twocolumn = true,
showframe = false,
}
\setlength{\columnseprule}{0.4pt}
\usepackage{lipsum}
\begin{document}
\lipsum[1-15]
\end{document}
分隔Tikz
符如下:
\begin{tikzpicture}
\draw[line width = 2pt] (0,0) to (0,-10);
\fill (0,-10.5) circle (.1);
\draw[red] (0,-10.5) circle (.3);
\fill[green, opacity=.3] (0,-10.5) circle (.4);
\draw[line width = 2pt] (0,-11) to (0,-21);
\end{tikzpicture}
在左边你可以看到我拥有的东西,在右边你可以看到我想要实现的东西:
答案1
您可以修补并用您的 Ti\@outputdblcol
替换\normalcolor\vrule\@width\columnseprule
钾Z 代码:
\documentclass[12pt,a5paper,twocolumn,twoside]{book}
\usepackage{geometry}
\geometry{
paper = a5paper,
layout = a5paper,
layoutsize = {148 mm, 210 mm},
includehead = true,
includefoot = true,
inner = 1.5 cm,
outer = 1 cm,
top = 1.5 cm,
bottom = 1.5 cm,
columnsep = .6cm,
twoside = true,
twocolumn = true,
showframe = false,
}
\setlength{\columnseprule}{0.4pt}
\usepackage{lipsum}
\usepackage{etoolbox}
\makeatletter
\show\@outputdblcol
\patchcmd\@outputdblcol
{\normalcolor\vrule\@width\columnseprule}
{\mydrawcolumnseprule}
{}{\GenericError{}{Patching \string\@outputdblcol\space failed}{}{}}
\makeatother
\usepackage{tikz}
\newcommand*\mydrawcolumnseprule
{%
% giving the lengths in multiples of `\textheight` seems like a good idea
\begin{tikzpicture}
\draw[line width = 2pt] (0,0) to (0,-.48\textheight);
\fill (0,-.5\textheight) circle (.005\textheight);
\draw[red] (0,-.5\textheight) circle (.01\textheight);
\fill[green, opacity=.3] (0,-.5\textheight) circle (.015\textheight);
\draw[line width = 2pt] (0,-.52\textheight) to (0,-\textheight);
\end{tikzpicture}%
}
\begin{document}
\lipsum[1-15]
\end{document}
编辑:以下内容告诉 TeX 其tikzpicture
尺寸为零,它将与文本块底部的某个位置对齐,因此您必须在正垂直方向上绘制才能获得相同的结果。
\documentclass[12pt,a5paper,twocolumn,twoside]{book}
\usepackage{geometry}
\geometry{
paper = a5paper,
layout = a5paper,
layoutsize = {148 mm, 210 mm},
includehead = true,
includefoot = true,
inner = 1.5 cm,
outer = 1 cm,
top = 1.5 cm,
bottom = 1.5 cm,
columnsep = .6cm,
twoside = true,
twocolumn = true,
showframe = false,
}
\setlength{\columnseprule}{0.4pt}
\usepackage{lipsum}
\usepackage{etoolbox}
\makeatletter
\patchcmd\@outputdblcol
{\normalcolor\vrule\@width\columnseprule}
{\mydrawcolumnseprule}
{}{\GenericError{}{Patching \string\@outputdblcol\space failed}{}{}}
\makeatother
\usepackage{tikz}
\newcommand*\mydrawcolumnseprule
{%
% giving the lengths in multiples of `\textheight` seems like a good idea
\begin{tikzpicture}
\useasboundingbox ; % now the tikzpicture doesn't take up any space
\draw[line width = 2pt] (0,-.01\textheight) to (0,.48\textheight);
\fill (0,.5\textheight) circle (.005\textheight);
\draw[red] (0,.5\textheight) circle (.01\textheight);
\fill[green, opacity=.3] (0,.5\textheight) circle (.015\textheight);
\draw[line width = 2pt] (0,.52\textheight) to (0,\textheight);
\end{tikzpicture}%
}
\begin{document}
\lipsum[1-15]
\end{document}