![如何创建不同类型的更改栏](https://linux22.com/image/404325/%E5%A6%82%E4%BD%95%E5%88%9B%E5%BB%BA%E4%B8%8D%E5%90%8C%E7%B1%BB%E5%9E%8B%E7%9A%84%E6%9B%B4%E6%94%B9%E6%A0%8F.png)
我需要在一个文档中标记两种不同类型的更改,但我不能使用不同的颜色。到目前为止,我发现的唯一解决方案是更改\changebarwidth
,但分别使用细的和粗的更改栏并不是满足我需求的“完美”解决方案。相反,我正在寻找一种解决方案来更改更改栏的类型,例如使用“双更改栏”(两个平行的更改栏)或虚线更改栏或类似的东西。我尝试过使用嵌套更改栏,但我无法\changebarsep
仅将第二个更改栏交替。是否有可行的解决方案来获取不同的更改栏?
更新:该解决方案也适用于超过两页(或更多页)的更改。
以下是示例代码:
\documentclass{article}
\usepackage{changebar}
\setlength\changebarsep{30pt}
\begin{document}
This is some text.\\
\cbstart
Here is some text that has to be marked with the usual changebar.
\cbend
\bigskip
This is some further text.\\
\cbstart
\setlength\changebarsep{15pt} %this seems not to have any effect at all
\cbstart
Here is some text that has to be marked with a different changebar.
\cbend
\cbend
\end{document}```
答案1
tikz 解决方案:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\newcommand{\tikzmark}[1]{\begin{tikzpicture}[overlay,remember picture] \coordinate (#1);\end{tikzpicture}}
\makeatletter
\newcommand{\myfsize}{\f@size pt}
\makeatother
\newcommand{\cbstart}[1][1]{\xdef\myArg{#1}\tikzmark{cbstart}}
\newcommand{\cbend}{\tikzmark{cbend}\foreach \i in {1,...,\myArg}{\begin{tikzpicture}[overlay,remember picture]\draw let \p1=(cbstart),\p2=(cbend),\p3=(current page.east) in ({\x3-2cm+\i*0.1cm},{\y1+\myfsize})--({\x3-2cm+\i*0.1cm},{\y2});\end{tikzpicture}}}
\begin{document}
This is some text.\\
\cbstart
Here is some text that has to be marked with the usual changebar.
\cbend
\bigskip
This is some further text.\\
\cbstart[2]
Here is some text that has to be marked with a changebar different Here is some text that has to be marked with a different.
\cbend
Some other text
\large
\cbstart[3]
Here is some text that has to be marked with a changebar different Here is some text that has to be marked with a different.Here is some text that has to be marked with a changebar different Here is some text that has to be marked with a different.
\cbend
\end{document}