How to get page number of tikzmark markers?











up vote
0
down vote

favorite












Given the following example using the tikzmark library:



documentclass{article}

usepackage{tikz}
usetikzlibrary{tikzmark}
usepackage{atbegshi}

AtBeginShipout{AtBeginShipoutUpperLeft{%
foreach n in {A,B} {%
ifnumarabic{page}=tikzmarkpage{n}
tikz[remember picture, overlay]
node[draw=blue] at (pic cs:n) {n};
fi
}
}}

newcommandtikzmarkpage[1]{%
% How to return the actual page number of marker #1 here?
arabic{page}%
}

begin{document}
tikzmark{A}
newpage
tikzmark{B}
end{document}


In this version the marks A and B are defined on different pages, but looping through all nodes in the AtBeginShipout hook makes all nodes being displayed on every page on top of each other. I know tikzmark already stores the page number the marker was defined on, I don't see a way to extract that information to use it for a check in the foreach loop, though.



So how would you define tikzmarkpage to get the corresponding page number for the given marker name?









share


























    up vote
    0
    down vote

    favorite












    Given the following example using the tikzmark library:



    documentclass{article}

    usepackage{tikz}
    usetikzlibrary{tikzmark}
    usepackage{atbegshi}

    AtBeginShipout{AtBeginShipoutUpperLeft{%
    foreach n in {A,B} {%
    ifnumarabic{page}=tikzmarkpage{n}
    tikz[remember picture, overlay]
    node[draw=blue] at (pic cs:n) {n};
    fi
    }
    }}

    newcommandtikzmarkpage[1]{%
    % How to return the actual page number of marker #1 here?
    arabic{page}%
    }

    begin{document}
    tikzmark{A}
    newpage
    tikzmark{B}
    end{document}


    In this version the marks A and B are defined on different pages, but looping through all nodes in the AtBeginShipout hook makes all nodes being displayed on every page on top of each other. I know tikzmark already stores the page number the marker was defined on, I don't see a way to extract that information to use it for a check in the foreach loop, though.



    So how would you define tikzmarkpage to get the corresponding page number for the given marker name?









    share
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Given the following example using the tikzmark library:



      documentclass{article}

      usepackage{tikz}
      usetikzlibrary{tikzmark}
      usepackage{atbegshi}

      AtBeginShipout{AtBeginShipoutUpperLeft{%
      foreach n in {A,B} {%
      ifnumarabic{page}=tikzmarkpage{n}
      tikz[remember picture, overlay]
      node[draw=blue] at (pic cs:n) {n};
      fi
      }
      }}

      newcommandtikzmarkpage[1]{%
      % How to return the actual page number of marker #1 here?
      arabic{page}%
      }

      begin{document}
      tikzmark{A}
      newpage
      tikzmark{B}
      end{document}


      In this version the marks A and B are defined on different pages, but looping through all nodes in the AtBeginShipout hook makes all nodes being displayed on every page on top of each other. I know tikzmark already stores the page number the marker was defined on, I don't see a way to extract that information to use it for a check in the foreach loop, though.



      So how would you define tikzmarkpage to get the corresponding page number for the given marker name?









      share













      Given the following example using the tikzmark library:



      documentclass{article}

      usepackage{tikz}
      usetikzlibrary{tikzmark}
      usepackage{atbegshi}

      AtBeginShipout{AtBeginShipoutUpperLeft{%
      foreach n in {A,B} {%
      ifnumarabic{page}=tikzmarkpage{n}
      tikz[remember picture, overlay]
      node[draw=blue] at (pic cs:n) {n};
      fi
      }
      }}

      newcommandtikzmarkpage[1]{%
      % How to return the actual page number of marker #1 here?
      arabic{page}%
      }

      begin{document}
      tikzmark{A}
      newpage
      tikzmark{B}
      end{document}


      In this version the marks A and B are defined on different pages, but looping through all nodes in the AtBeginShipout hook makes all nodes being displayed on every page on top of each other. I know tikzmark already stores the page number the marker was defined on, I don't see a way to extract that information to use it for a check in the foreach loop, though.



      So how would you define tikzmarkpage to get the corresponding page number for the given marker name?







      tikzmark atbegshi





      share












      share










      share



      share










      asked 3 mins ago









      siracusa

      4,46411127




      4,46411127



























          active

          oldest

          votes











          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',
          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%2f462319%2fhow-to-get-page-number-of-tikzmark-markers%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462319%2fhow-to-get-page-number-of-tikzmark-markers%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

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)