Test if tikzmark exists on same pageTikz - How to overlay Decorations over longtableExporting animation...

Today is the Center

How do we improve the relationship with a client software team that performs poorly and is becoming less collaborative?

Is it legal for company to use my work email to pretend I still work there?

What does "Puller Prush Person" mean?

How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?

Arthur Somervell: 1000 Exercises - Meaning of this notation

Test if tikzmark exists on same page

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

Modeling an IPv4 Address

Why are electrically insulating heatsinks so rare? Is it just cost?

How much RAM could one put in a typical 80386 setup?

How to find program name(s) of an installed package?

What does it mean : "Canonical representative of Sbox is 0123468A5BCF79DE"? and How can we calculate this representative for Sbox?

"to be prejudice towards/against someone" vs "to be prejudiced against/towards someone"

Can a Warlock become Neutral Good?

The use of multiple foreign keys on same column in SQL Server

Do VLANs within a subnet need to have their own subnet for router on a stick?

Collect Fourier series terms

To string or not to string

"You are your self first supporter", a more proper way to say it

Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?

What is the offset in a seaplane's hull?

Risk of getting Chronic Wasting Disease (CWD) in the United States?

Writing rule stating superpower from different root cause is bad writing



Test if tikzmark exists on same page


Tikz - How to overlay Decorations over longtableExporting animation created with animate packageMark (highlight) a paragraph (item{…}) with a squiggly line for later attentiontikzmarknode lines with hooksRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?TikZ: Drawing an arc from an intersection to an intersectionLine up nested tikz enviroments or how to get rid of themProblems with nested TikZpicturesDrawing tikz line in the margin for multiple pagesUsing Tikzmark and ArrowsLabelings with Tikzmark













3















Apologies for flooding the site with tikzmark problems ... :)



I know that with iftikzmark I can test if a given tikzmark exists in general. Is there a way to test if a particular tikzmark exists on the same page?



Use case: I'm trying to design macros that I can insert anywhere in a text that would draw a line between them –- a linestart and a linefinish command. However, when the linefinish command happens to fall on a subsequent page, the line gets drawn to where the linestart command was on the previous page. I would rather have it instead "do something else", here, just for purpose of illustration, draw me a black square – or, ideally "point across" the page in the direction to where the other mark is sitting.



In the code below, I've tried to construct what I'm envisioning using iftikzmark but that does not work.



documentclass{article}
usepackage{tikz}
usetikzlibrary{tikzmark}
newcounter{tikzmkstart}setcounter{tikzmkstart}{0} %
newcounter{tikzmkfinish}setcounter{tikzmkfinish}{0} %

newcommand{linestart}{%
stepcounter{tikzmkfinish}iftikzmark{bthetikzmkfinish}{% tikzmark exists on same page
stepcounter{tikzmkstart}tikzmarknode{athetikzmkstart}{vphantom{x}}addtocounter{tikzmkfinish}{-1}}
{% tikzmark doesn't exist on page
begin{tikzpicture} draw [line width=4] (0,0) -- (.1,0); end{tikzpicture}addtocounter{tikzmkfinish}{-1}}}% black square if linefinish on next page

newcommand{linefinish}{%
iftikzmark{athetikzmkstart}{% tikzmark exists on same page
stepcounter{tikzmkfinish}tikzmarknode{bthetikzmkfinish}{vphantom{x}}begin{tikzpicture}[remember picture] draw[overlay] (athetikzmkstart.west) -- (bthetikzmkfinish.west); end{tikzpicture}}
{% tikzmark doesn't exist on page
begin{tikzpicture} draw [line width=4] (0,0) -- (.1,0); end{tikzpicture}}}

begin{document}
Text linestart text text

Text text text
%newpage

Text text linefinish text
end{document}


Any ideas of how else I might accomplish something like this would be very welcome!





Update: Based on @marmot's suggestion to look at this answer, I've now come up with the following. However, I'm stuck with how to make the lines "point across" the page breaks ...



documentclass{article}
usepackage{refcount}
usepackage{tikz}
usetikzlibrary{calc}

newcounter{tmp}
newcommandtikzmark[1]{%
tikz[overlay,remember picture] node (#1) {};}

newcommandlinestart{%
stepcounter{tmp}%
tikzmark{a}label{athetmp}%
ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp} else
begin{tikzpicture}[overlay, remember picture]
draw [thick]
(a.west) -- (b.west);
end{tikzpicture}%
fi%
}


newcommandlinefinish{%
tikzmark{b}label{bthetmp}
ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp}
begin{tikzpicture}[overlay, remember picture]
draw [thick]
(a.west) -- (b.west);
end{tikzpicture}%
else
begin{tikzpicture}[overlay, remember picture]
draw [thick]
(a.west) -- (b.west);
end{tikzpicture}%
fi
}

newcommandSqu[1]{linestart#1linefinish}

begin{document}

Text linestart text text

Text text text

Text text linefinish text

Text linestart text text

Text text text
newpage

Text text linefinish text

end{document}









share|improve this question

























  • The way you write the questions may indicate that you are about to construct a tikzmar version of something like this answer. The basic trick is that you build in the page number.

    – marmot
    8 hours ago











  • @marmot Oh, you mean incorporating the pagenumber into the label for the node. Ha, that's clever.

    – jan
    8 hours ago











  • Yes, basically. If you also want the line to also run over page breaks, you may need refcount, like in Gonzalo's answer.

    – marmot
    8 hours ago






  • 1





    tikzmark already saves the page number on which it is defined (see tex.stackexchange.com/q/79121/86 for a use of this, and look at next page in the documentation). There isn't a current direct interface to that information; it is stored as save@pg@<picture id of the tikzmark> so you could do a test on that. I'm not going to attempt to get the expansions right in a comment, but something like ifnumcsname save@pg@pgfpictureidendcsname=csname save@pg@csname save@pt@tmk@labelendcsnameendcsname

    – Loop Space
    8 hours ago











  • @LoopSpace Hmm, that looks fairly complex. Would you be able to explain where I incorporate that?

    – jan
    7 hours ago
















3















Apologies for flooding the site with tikzmark problems ... :)



I know that with iftikzmark I can test if a given tikzmark exists in general. Is there a way to test if a particular tikzmark exists on the same page?



Use case: I'm trying to design macros that I can insert anywhere in a text that would draw a line between them –- a linestart and a linefinish command. However, when the linefinish command happens to fall on a subsequent page, the line gets drawn to where the linestart command was on the previous page. I would rather have it instead "do something else", here, just for purpose of illustration, draw me a black square – or, ideally "point across" the page in the direction to where the other mark is sitting.



In the code below, I've tried to construct what I'm envisioning using iftikzmark but that does not work.



documentclass{article}
usepackage{tikz}
usetikzlibrary{tikzmark}
newcounter{tikzmkstart}setcounter{tikzmkstart}{0} %
newcounter{tikzmkfinish}setcounter{tikzmkfinish}{0} %

newcommand{linestart}{%
stepcounter{tikzmkfinish}iftikzmark{bthetikzmkfinish}{% tikzmark exists on same page
stepcounter{tikzmkstart}tikzmarknode{athetikzmkstart}{vphantom{x}}addtocounter{tikzmkfinish}{-1}}
{% tikzmark doesn't exist on page
begin{tikzpicture} draw [line width=4] (0,0) -- (.1,0); end{tikzpicture}addtocounter{tikzmkfinish}{-1}}}% black square if linefinish on next page

newcommand{linefinish}{%
iftikzmark{athetikzmkstart}{% tikzmark exists on same page
stepcounter{tikzmkfinish}tikzmarknode{bthetikzmkfinish}{vphantom{x}}begin{tikzpicture}[remember picture] draw[overlay] (athetikzmkstart.west) -- (bthetikzmkfinish.west); end{tikzpicture}}
{% tikzmark doesn't exist on page
begin{tikzpicture} draw [line width=4] (0,0) -- (.1,0); end{tikzpicture}}}

begin{document}
Text linestart text text

Text text text
%newpage

Text text linefinish text
end{document}


Any ideas of how else I might accomplish something like this would be very welcome!





Update: Based on @marmot's suggestion to look at this answer, I've now come up with the following. However, I'm stuck with how to make the lines "point across" the page breaks ...



documentclass{article}
usepackage{refcount}
usepackage{tikz}
usetikzlibrary{calc}

newcounter{tmp}
newcommandtikzmark[1]{%
tikz[overlay,remember picture] node (#1) {};}

newcommandlinestart{%
stepcounter{tmp}%
tikzmark{a}label{athetmp}%
ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp} else
begin{tikzpicture}[overlay, remember picture]
draw [thick]
(a.west) -- (b.west);
end{tikzpicture}%
fi%
}


newcommandlinefinish{%
tikzmark{b}label{bthetmp}
ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp}
begin{tikzpicture}[overlay, remember picture]
draw [thick]
(a.west) -- (b.west);
end{tikzpicture}%
else
begin{tikzpicture}[overlay, remember picture]
draw [thick]
(a.west) -- (b.west);
end{tikzpicture}%
fi
}

newcommandSqu[1]{linestart#1linefinish}

begin{document}

Text linestart text text

Text text text

Text text linefinish text

Text linestart text text

Text text text
newpage

Text text linefinish text

end{document}









share|improve this question

























  • The way you write the questions may indicate that you are about to construct a tikzmar version of something like this answer. The basic trick is that you build in the page number.

    – marmot
    8 hours ago











  • @marmot Oh, you mean incorporating the pagenumber into the label for the node. Ha, that's clever.

    – jan
    8 hours ago











  • Yes, basically. If you also want the line to also run over page breaks, you may need refcount, like in Gonzalo's answer.

    – marmot
    8 hours ago






  • 1





    tikzmark already saves the page number on which it is defined (see tex.stackexchange.com/q/79121/86 for a use of this, and look at next page in the documentation). There isn't a current direct interface to that information; it is stored as save@pg@<picture id of the tikzmark> so you could do a test on that. I'm not going to attempt to get the expansions right in a comment, but something like ifnumcsname save@pg@pgfpictureidendcsname=csname save@pg@csname save@pt@tmk@labelendcsnameendcsname

    – Loop Space
    8 hours ago











  • @LoopSpace Hmm, that looks fairly complex. Would you be able to explain where I incorporate that?

    – jan
    7 hours ago














3












3








3








Apologies for flooding the site with tikzmark problems ... :)



I know that with iftikzmark I can test if a given tikzmark exists in general. Is there a way to test if a particular tikzmark exists on the same page?



Use case: I'm trying to design macros that I can insert anywhere in a text that would draw a line between them –- a linestart and a linefinish command. However, when the linefinish command happens to fall on a subsequent page, the line gets drawn to where the linestart command was on the previous page. I would rather have it instead "do something else", here, just for purpose of illustration, draw me a black square – or, ideally "point across" the page in the direction to where the other mark is sitting.



In the code below, I've tried to construct what I'm envisioning using iftikzmark but that does not work.



documentclass{article}
usepackage{tikz}
usetikzlibrary{tikzmark}
newcounter{tikzmkstart}setcounter{tikzmkstart}{0} %
newcounter{tikzmkfinish}setcounter{tikzmkfinish}{0} %

newcommand{linestart}{%
stepcounter{tikzmkfinish}iftikzmark{bthetikzmkfinish}{% tikzmark exists on same page
stepcounter{tikzmkstart}tikzmarknode{athetikzmkstart}{vphantom{x}}addtocounter{tikzmkfinish}{-1}}
{% tikzmark doesn't exist on page
begin{tikzpicture} draw [line width=4] (0,0) -- (.1,0); end{tikzpicture}addtocounter{tikzmkfinish}{-1}}}% black square if linefinish on next page

newcommand{linefinish}{%
iftikzmark{athetikzmkstart}{% tikzmark exists on same page
stepcounter{tikzmkfinish}tikzmarknode{bthetikzmkfinish}{vphantom{x}}begin{tikzpicture}[remember picture] draw[overlay] (athetikzmkstart.west) -- (bthetikzmkfinish.west); end{tikzpicture}}
{% tikzmark doesn't exist on page
begin{tikzpicture} draw [line width=4] (0,0) -- (.1,0); end{tikzpicture}}}

begin{document}
Text linestart text text

Text text text
%newpage

Text text linefinish text
end{document}


Any ideas of how else I might accomplish something like this would be very welcome!





Update: Based on @marmot's suggestion to look at this answer, I've now come up with the following. However, I'm stuck with how to make the lines "point across" the page breaks ...



documentclass{article}
usepackage{refcount}
usepackage{tikz}
usetikzlibrary{calc}

newcounter{tmp}
newcommandtikzmark[1]{%
tikz[overlay,remember picture] node (#1) {};}

newcommandlinestart{%
stepcounter{tmp}%
tikzmark{a}label{athetmp}%
ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp} else
begin{tikzpicture}[overlay, remember picture]
draw [thick]
(a.west) -- (b.west);
end{tikzpicture}%
fi%
}


newcommandlinefinish{%
tikzmark{b}label{bthetmp}
ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp}
begin{tikzpicture}[overlay, remember picture]
draw [thick]
(a.west) -- (b.west);
end{tikzpicture}%
else
begin{tikzpicture}[overlay, remember picture]
draw [thick]
(a.west) -- (b.west);
end{tikzpicture}%
fi
}

newcommandSqu[1]{linestart#1linefinish}

begin{document}

Text linestart text text

Text text text

Text text linefinish text

Text linestart text text

Text text text
newpage

Text text linefinish text

end{document}









share|improve this question
















Apologies for flooding the site with tikzmark problems ... :)



I know that with iftikzmark I can test if a given tikzmark exists in general. Is there a way to test if a particular tikzmark exists on the same page?



Use case: I'm trying to design macros that I can insert anywhere in a text that would draw a line between them –- a linestart and a linefinish command. However, when the linefinish command happens to fall on a subsequent page, the line gets drawn to where the linestart command was on the previous page. I would rather have it instead "do something else", here, just for purpose of illustration, draw me a black square – or, ideally "point across" the page in the direction to where the other mark is sitting.



In the code below, I've tried to construct what I'm envisioning using iftikzmark but that does not work.



documentclass{article}
usepackage{tikz}
usetikzlibrary{tikzmark}
newcounter{tikzmkstart}setcounter{tikzmkstart}{0} %
newcounter{tikzmkfinish}setcounter{tikzmkfinish}{0} %

newcommand{linestart}{%
stepcounter{tikzmkfinish}iftikzmark{bthetikzmkfinish}{% tikzmark exists on same page
stepcounter{tikzmkstart}tikzmarknode{athetikzmkstart}{vphantom{x}}addtocounter{tikzmkfinish}{-1}}
{% tikzmark doesn't exist on page
begin{tikzpicture} draw [line width=4] (0,0) -- (.1,0); end{tikzpicture}addtocounter{tikzmkfinish}{-1}}}% black square if linefinish on next page

newcommand{linefinish}{%
iftikzmark{athetikzmkstart}{% tikzmark exists on same page
stepcounter{tikzmkfinish}tikzmarknode{bthetikzmkfinish}{vphantom{x}}begin{tikzpicture}[remember picture] draw[overlay] (athetikzmkstart.west) -- (bthetikzmkfinish.west); end{tikzpicture}}
{% tikzmark doesn't exist on page
begin{tikzpicture} draw [line width=4] (0,0) -- (.1,0); end{tikzpicture}}}

begin{document}
Text linestart text text

Text text text
%newpage

Text text linefinish text
end{document}


Any ideas of how else I might accomplish something like this would be very welcome!





Update: Based on @marmot's suggestion to look at this answer, I've now come up with the following. However, I'm stuck with how to make the lines "point across" the page breaks ...



documentclass{article}
usepackage{refcount}
usepackage{tikz}
usetikzlibrary{calc}

newcounter{tmp}
newcommandtikzmark[1]{%
tikz[overlay,remember picture] node (#1) {};}

newcommandlinestart{%
stepcounter{tmp}%
tikzmark{a}label{athetmp}%
ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp} else
begin{tikzpicture}[overlay, remember picture]
draw [thick]
(a.west) -- (b.west);
end{tikzpicture}%
fi%
}


newcommandlinefinish{%
tikzmark{b}label{bthetmp}
ifnumgetpagerefnumber{athetmp}=getpagerefnumber{bthetmp}
begin{tikzpicture}[overlay, remember picture]
draw [thick]
(a.west) -- (b.west);
end{tikzpicture}%
else
begin{tikzpicture}[overlay, remember picture]
draw [thick]
(a.west) -- (b.west);
end{tikzpicture}%
fi
}

newcommandSqu[1]{linestart#1linefinish}

begin{document}

Text linestart text text

Text text text

Text text linefinish text

Text linestart text text

Text text text
newpage

Text text linefinish text

end{document}






tikz-pgf macros tikzmark






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 7 hours ago







jan

















asked 8 hours ago









janjan

1,0491519




1,0491519













  • The way you write the questions may indicate that you are about to construct a tikzmar version of something like this answer. The basic trick is that you build in the page number.

    – marmot
    8 hours ago











  • @marmot Oh, you mean incorporating the pagenumber into the label for the node. Ha, that's clever.

    – jan
    8 hours ago











  • Yes, basically. If you also want the line to also run over page breaks, you may need refcount, like in Gonzalo's answer.

    – marmot
    8 hours ago






  • 1





    tikzmark already saves the page number on which it is defined (see tex.stackexchange.com/q/79121/86 for a use of this, and look at next page in the documentation). There isn't a current direct interface to that information; it is stored as save@pg@<picture id of the tikzmark> so you could do a test on that. I'm not going to attempt to get the expansions right in a comment, but something like ifnumcsname save@pg@pgfpictureidendcsname=csname save@pg@csname save@pt@tmk@labelendcsnameendcsname

    – Loop Space
    8 hours ago











  • @LoopSpace Hmm, that looks fairly complex. Would you be able to explain where I incorporate that?

    – jan
    7 hours ago



















  • The way you write the questions may indicate that you are about to construct a tikzmar version of something like this answer. The basic trick is that you build in the page number.

    – marmot
    8 hours ago











  • @marmot Oh, you mean incorporating the pagenumber into the label for the node. Ha, that's clever.

    – jan
    8 hours ago











  • Yes, basically. If you also want the line to also run over page breaks, you may need refcount, like in Gonzalo's answer.

    – marmot
    8 hours ago






  • 1





    tikzmark already saves the page number on which it is defined (see tex.stackexchange.com/q/79121/86 for a use of this, and look at next page in the documentation). There isn't a current direct interface to that information; it is stored as save@pg@<picture id of the tikzmark> so you could do a test on that. I'm not going to attempt to get the expansions right in a comment, but something like ifnumcsname save@pg@pgfpictureidendcsname=csname save@pg@csname save@pt@tmk@labelendcsnameendcsname

    – Loop Space
    8 hours ago











  • @LoopSpace Hmm, that looks fairly complex. Would you be able to explain where I incorporate that?

    – jan
    7 hours ago

















The way you write the questions may indicate that you are about to construct a tikzmar version of something like this answer. The basic trick is that you build in the page number.

– marmot
8 hours ago





The way you write the questions may indicate that you are about to construct a tikzmar version of something like this answer. The basic trick is that you build in the page number.

– marmot
8 hours ago













@marmot Oh, you mean incorporating the pagenumber into the label for the node. Ha, that's clever.

– jan
8 hours ago





@marmot Oh, you mean incorporating the pagenumber into the label for the node. Ha, that's clever.

– jan
8 hours ago













Yes, basically. If you also want the line to also run over page breaks, you may need refcount, like in Gonzalo's answer.

– marmot
8 hours ago





Yes, basically. If you also want the line to also run over page breaks, you may need refcount, like in Gonzalo's answer.

– marmot
8 hours ago




1




1





tikzmark already saves the page number on which it is defined (see tex.stackexchange.com/q/79121/86 for a use of this, and look at next page in the documentation). There isn't a current direct interface to that information; it is stored as save@pg@<picture id of the tikzmark> so you could do a test on that. I'm not going to attempt to get the expansions right in a comment, but something like ifnumcsname save@pg@pgfpictureidendcsname=csname save@pg@csname save@pt@tmk@labelendcsnameendcsname

– Loop Space
8 hours ago





tikzmark already saves the page number on which it is defined (see tex.stackexchange.com/q/79121/86 for a use of this, and look at next page in the documentation). There isn't a current direct interface to that information; it is stored as save@pg@<picture id of the tikzmark> so you could do a test on that. I'm not going to attempt to get the expansions right in a comment, but something like ifnumcsname save@pg@pgfpictureidendcsname=csname save@pg@csname save@pt@tmk@labelendcsnameendcsname

– Loop Space
8 hours ago













@LoopSpace Hmm, that looks fairly complex. Would you be able to explain where I incorporate that?

– jan
7 hours ago





@LoopSpace Hmm, that looks fairly complex. Would you be able to explain where I incorporate that?

– jan
7 hours ago










1 Answer
1






active

oldest

votes


















5














I can see the point of having a iftikzmarkonpage conditional, so I've added it to the tikzmark package (download tikzmark.dtx and run tex tikzmark.dtx to get the latest version). This introduces a new conditional, iftikzmarkoncurrentpage{<tikzmark name>}. That copes with the issue about the lines being drawn on both pages when needed.



documentclass{article}
usepackage[a6paper]{geometry}
%url{https://tex.stackexchange.com/q/483547/86}
usepackage{tikz}
usepackage{tikzpagenodes}
usetikzlibrary{tikzmark}
newcounter{tikzmarklines}setcounter{tikzmarklines}{0} %

tikzset{
tikzmark prefix=prefix-,
tikzmark suffix=-suffix
}

newcommand{linestart}{%
stepcounter{tikzmarklines}%
tikzmark{athetikzmarklines}%
iftikzmarkoncurrentpage{bthetikzmarklines}%
else
begin{tikzpicture}[remember picture,overlay,next page=below]%
clip (current page text area.south west) rectangle (current page text area.north east);
draw[line width=4] (pic cs:athetikzmarklines) -- (pic cs:bthetikzmarklines);
end{tikzpicture}%
fi
}

newcommand{linefinish}{%
tikzmark{bthetikzmarklines}%
begin{tikzpicture}[remember picture,overlay,next page=below]%
clip (current page text area.south west) rectangle (current page text area.north east);
draw[line width=1] (pic cs:athetikzmarklines) -- (pic cs:bthetikzmarklines);
end{tikzpicture}%
}

begin{document}
Text linestart text text

Text text text

Text text linefinish text

newpage

Text text text

Text linestart text text

Text text text
newpage

Text text text

Text text linefinish text
end{document}


lines between pages






share|improve this answer


























  • That looks like it does what I'm after :) thank you ... and if you incorporate a conditional into the package, even better :) Although ... didn't Gonzalo's answer solve that? Why would his solution be bad?

    – jan
    6 hours ago











  • Please feel free to revert my edit. +1

    – marmot
    6 hours ago











  • @marmot, I like the gifs ;)

    – jan
    6 hours ago






  • 1





    @jan convert -density 300 -delay 144 -loop 0 -alpha remove multipage.pdf animated.gif, see tex.stackexchange.com/a/136919/121799.

    – marmot
    6 hours ago






  • 1





    @jan You can use tikz-pagenodes, which has the current page text area node. And I think you are doing it right because in their present form the questions and answers are useful for many, which they are not if you do some highly specialized things. (Will be off now.)

    – marmot
    6 hours ago












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f483547%2ftest-if-tikzmark-exists-on-same-page%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














I can see the point of having a iftikzmarkonpage conditional, so I've added it to the tikzmark package (download tikzmark.dtx and run tex tikzmark.dtx to get the latest version). This introduces a new conditional, iftikzmarkoncurrentpage{<tikzmark name>}. That copes with the issue about the lines being drawn on both pages when needed.



documentclass{article}
usepackage[a6paper]{geometry}
%url{https://tex.stackexchange.com/q/483547/86}
usepackage{tikz}
usepackage{tikzpagenodes}
usetikzlibrary{tikzmark}
newcounter{tikzmarklines}setcounter{tikzmarklines}{0} %

tikzset{
tikzmark prefix=prefix-,
tikzmark suffix=-suffix
}

newcommand{linestart}{%
stepcounter{tikzmarklines}%
tikzmark{athetikzmarklines}%
iftikzmarkoncurrentpage{bthetikzmarklines}%
else
begin{tikzpicture}[remember picture,overlay,next page=below]%
clip (current page text area.south west) rectangle (current page text area.north east);
draw[line width=4] (pic cs:athetikzmarklines) -- (pic cs:bthetikzmarklines);
end{tikzpicture}%
fi
}

newcommand{linefinish}{%
tikzmark{bthetikzmarklines}%
begin{tikzpicture}[remember picture,overlay,next page=below]%
clip (current page text area.south west) rectangle (current page text area.north east);
draw[line width=1] (pic cs:athetikzmarklines) -- (pic cs:bthetikzmarklines);
end{tikzpicture}%
}

begin{document}
Text linestart text text

Text text text

Text text linefinish text

newpage

Text text text

Text linestart text text

Text text text
newpage

Text text text

Text text linefinish text
end{document}


lines between pages






share|improve this answer


























  • That looks like it does what I'm after :) thank you ... and if you incorporate a conditional into the package, even better :) Although ... didn't Gonzalo's answer solve that? Why would his solution be bad?

    – jan
    6 hours ago











  • Please feel free to revert my edit. +1

    – marmot
    6 hours ago











  • @marmot, I like the gifs ;)

    – jan
    6 hours ago






  • 1





    @jan convert -density 300 -delay 144 -loop 0 -alpha remove multipage.pdf animated.gif, see tex.stackexchange.com/a/136919/121799.

    – marmot
    6 hours ago






  • 1





    @jan You can use tikz-pagenodes, which has the current page text area node. And I think you are doing it right because in their present form the questions and answers are useful for many, which they are not if you do some highly specialized things. (Will be off now.)

    – marmot
    6 hours ago
















5














I can see the point of having a iftikzmarkonpage conditional, so I've added it to the tikzmark package (download tikzmark.dtx and run tex tikzmark.dtx to get the latest version). This introduces a new conditional, iftikzmarkoncurrentpage{<tikzmark name>}. That copes with the issue about the lines being drawn on both pages when needed.



documentclass{article}
usepackage[a6paper]{geometry}
%url{https://tex.stackexchange.com/q/483547/86}
usepackage{tikz}
usepackage{tikzpagenodes}
usetikzlibrary{tikzmark}
newcounter{tikzmarklines}setcounter{tikzmarklines}{0} %

tikzset{
tikzmark prefix=prefix-,
tikzmark suffix=-suffix
}

newcommand{linestart}{%
stepcounter{tikzmarklines}%
tikzmark{athetikzmarklines}%
iftikzmarkoncurrentpage{bthetikzmarklines}%
else
begin{tikzpicture}[remember picture,overlay,next page=below]%
clip (current page text area.south west) rectangle (current page text area.north east);
draw[line width=4] (pic cs:athetikzmarklines) -- (pic cs:bthetikzmarklines);
end{tikzpicture}%
fi
}

newcommand{linefinish}{%
tikzmark{bthetikzmarklines}%
begin{tikzpicture}[remember picture,overlay,next page=below]%
clip (current page text area.south west) rectangle (current page text area.north east);
draw[line width=1] (pic cs:athetikzmarklines) -- (pic cs:bthetikzmarklines);
end{tikzpicture}%
}

begin{document}
Text linestart text text

Text text text

Text text linefinish text

newpage

Text text text

Text linestart text text

Text text text
newpage

Text text text

Text text linefinish text
end{document}


lines between pages






share|improve this answer


























  • That looks like it does what I'm after :) thank you ... and if you incorporate a conditional into the package, even better :) Although ... didn't Gonzalo's answer solve that? Why would his solution be bad?

    – jan
    6 hours ago











  • Please feel free to revert my edit. +1

    – marmot
    6 hours ago











  • @marmot, I like the gifs ;)

    – jan
    6 hours ago






  • 1





    @jan convert -density 300 -delay 144 -loop 0 -alpha remove multipage.pdf animated.gif, see tex.stackexchange.com/a/136919/121799.

    – marmot
    6 hours ago






  • 1





    @jan You can use tikz-pagenodes, which has the current page text area node. And I think you are doing it right because in their present form the questions and answers are useful for many, which they are not if you do some highly specialized things. (Will be off now.)

    – marmot
    6 hours ago














5












5








5







I can see the point of having a iftikzmarkonpage conditional, so I've added it to the tikzmark package (download tikzmark.dtx and run tex tikzmark.dtx to get the latest version). This introduces a new conditional, iftikzmarkoncurrentpage{<tikzmark name>}. That copes with the issue about the lines being drawn on both pages when needed.



documentclass{article}
usepackage[a6paper]{geometry}
%url{https://tex.stackexchange.com/q/483547/86}
usepackage{tikz}
usepackage{tikzpagenodes}
usetikzlibrary{tikzmark}
newcounter{tikzmarklines}setcounter{tikzmarklines}{0} %

tikzset{
tikzmark prefix=prefix-,
tikzmark suffix=-suffix
}

newcommand{linestart}{%
stepcounter{tikzmarklines}%
tikzmark{athetikzmarklines}%
iftikzmarkoncurrentpage{bthetikzmarklines}%
else
begin{tikzpicture}[remember picture,overlay,next page=below]%
clip (current page text area.south west) rectangle (current page text area.north east);
draw[line width=4] (pic cs:athetikzmarklines) -- (pic cs:bthetikzmarklines);
end{tikzpicture}%
fi
}

newcommand{linefinish}{%
tikzmark{bthetikzmarklines}%
begin{tikzpicture}[remember picture,overlay,next page=below]%
clip (current page text area.south west) rectangle (current page text area.north east);
draw[line width=1] (pic cs:athetikzmarklines) -- (pic cs:bthetikzmarklines);
end{tikzpicture}%
}

begin{document}
Text linestart text text

Text text text

Text text linefinish text

newpage

Text text text

Text linestart text text

Text text text
newpage

Text text text

Text text linefinish text
end{document}


lines between pages






share|improve this answer















I can see the point of having a iftikzmarkonpage conditional, so I've added it to the tikzmark package (download tikzmark.dtx and run tex tikzmark.dtx to get the latest version). This introduces a new conditional, iftikzmarkoncurrentpage{<tikzmark name>}. That copes with the issue about the lines being drawn on both pages when needed.



documentclass{article}
usepackage[a6paper]{geometry}
%url{https://tex.stackexchange.com/q/483547/86}
usepackage{tikz}
usepackage{tikzpagenodes}
usetikzlibrary{tikzmark}
newcounter{tikzmarklines}setcounter{tikzmarklines}{0} %

tikzset{
tikzmark prefix=prefix-,
tikzmark suffix=-suffix
}

newcommand{linestart}{%
stepcounter{tikzmarklines}%
tikzmark{athetikzmarklines}%
iftikzmarkoncurrentpage{bthetikzmarklines}%
else
begin{tikzpicture}[remember picture,overlay,next page=below]%
clip (current page text area.south west) rectangle (current page text area.north east);
draw[line width=4] (pic cs:athetikzmarklines) -- (pic cs:bthetikzmarklines);
end{tikzpicture}%
fi
}

newcommand{linefinish}{%
tikzmark{bthetikzmarklines}%
begin{tikzpicture}[remember picture,overlay,next page=below]%
clip (current page text area.south west) rectangle (current page text area.north east);
draw[line width=1] (pic cs:athetikzmarklines) -- (pic cs:bthetikzmarklines);
end{tikzpicture}%
}

begin{document}
Text linestart text text

Text text text

Text text linefinish text

newpage

Text text text

Text linestart text text

Text text text
newpage

Text text text

Text text linefinish text
end{document}


lines between pages







share|improve this answer














share|improve this answer



share|improve this answer








edited 4 hours ago

























answered 6 hours ago









Loop SpaceLoop Space

113k30309610




113k30309610













  • That looks like it does what I'm after :) thank you ... and if you incorporate a conditional into the package, even better :) Although ... didn't Gonzalo's answer solve that? Why would his solution be bad?

    – jan
    6 hours ago











  • Please feel free to revert my edit. +1

    – marmot
    6 hours ago











  • @marmot, I like the gifs ;)

    – jan
    6 hours ago






  • 1





    @jan convert -density 300 -delay 144 -loop 0 -alpha remove multipage.pdf animated.gif, see tex.stackexchange.com/a/136919/121799.

    – marmot
    6 hours ago






  • 1





    @jan You can use tikz-pagenodes, which has the current page text area node. And I think you are doing it right because in their present form the questions and answers are useful for many, which they are not if you do some highly specialized things. (Will be off now.)

    – marmot
    6 hours ago



















  • That looks like it does what I'm after :) thank you ... and if you incorporate a conditional into the package, even better :) Although ... didn't Gonzalo's answer solve that? Why would his solution be bad?

    – jan
    6 hours ago











  • Please feel free to revert my edit. +1

    – marmot
    6 hours ago











  • @marmot, I like the gifs ;)

    – jan
    6 hours ago






  • 1





    @jan convert -density 300 -delay 144 -loop 0 -alpha remove multipage.pdf animated.gif, see tex.stackexchange.com/a/136919/121799.

    – marmot
    6 hours ago






  • 1





    @jan You can use tikz-pagenodes, which has the current page text area node. And I think you are doing it right because in their present form the questions and answers are useful for many, which they are not if you do some highly specialized things. (Will be off now.)

    – marmot
    6 hours ago

















That looks like it does what I'm after :) thank you ... and if you incorporate a conditional into the package, even better :) Although ... didn't Gonzalo's answer solve that? Why would his solution be bad?

– jan
6 hours ago





That looks like it does what I'm after :) thank you ... and if you incorporate a conditional into the package, even better :) Although ... didn't Gonzalo's answer solve that? Why would his solution be bad?

– jan
6 hours ago













Please feel free to revert my edit. +1

– marmot
6 hours ago





Please feel free to revert my edit. +1

– marmot
6 hours ago













@marmot, I like the gifs ;)

– jan
6 hours ago





@marmot, I like the gifs ;)

– jan
6 hours ago




1




1





@jan convert -density 300 -delay 144 -loop 0 -alpha remove multipage.pdf animated.gif, see tex.stackexchange.com/a/136919/121799.

– marmot
6 hours ago





@jan convert -density 300 -delay 144 -loop 0 -alpha remove multipage.pdf animated.gif, see tex.stackexchange.com/a/136919/121799.

– marmot
6 hours ago




1




1





@jan You can use tikz-pagenodes, which has the current page text area node. And I think you are doing it right because in their present form the questions and answers are useful for many, which they are not if you do some highly specialized things. (Will be off now.)

– marmot
6 hours ago





@jan You can use tikz-pagenodes, which has the current page text area node. And I think you are doing it right because in their present form the questions and answers are useful for many, which they are not if you do some highly specialized things. (Will be off now.)

– marmot
6 hours ago


















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f483547%2ftest-if-tikzmark-exists-on-same-page%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

El tren de la libertad Índice Antecedentes "Porque yo decido" Desarrollo de la...

Castillo d'Acher Características Menú de navegación

Connecting two nodes from the same mother node horizontallyTikZ: What EXACTLY does the the |- notation for...