TransWikia.com

How to create different types of changebars

TeX - LaTeX Asked on June 4, 2021

I need to mark two different types of changes in a document, but I cannot use different colours. The only solution I found so far is to change the changebarwidth, but using a thin and a thick changebar, respectively, is not a ‘beautiful’ solution for my needs. Instead, I am looking for a solution to change the type of the changebar, e.g. using a “double-changebar” (two parallel changebars) or a dashed changebar or something like that.
I have tried to use nested changebars but I was not able to alternate the changebarsep for the second changebar only. Is there a feasible solution for getting different changebars?

Update: The solution should also work for changes that go over two (or more) pages.

Here is an example code:

documentclass{article}

usepackage{changebar}

setlengthchangebarsep{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 
setlengthchangebarsep{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}```

One Answer

A tikz solution:

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]{xdefmyArg{#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}

enter image description here

Answered by koleygr on June 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP