0

I'd like to create a single label in ref containing multiple values (page, counter, position...). I'm not sure why, but using zref I can't manage to get access to the counter value, the zposx value... Am I doing something wrong?

\documentclass[]{article}
\usepackage{tikz}
\usepackage{zref-savepos,zref-abspage,zref-user,zref-counter,zref-abspos,zref-pagelayout}
\makeatletter
%% Create a list of properties to register for our labels (by default labels only ship with a subset of properties)
%% See https://mirror.ibcp.fr/pub/CTAN/macros/latex/contrib/zref/zref.pdf, "Declared properties" page 10
\zref@newlist{subproof}
\zref@addprops{subproof}{abspage,posx,posy,counter,pagevalue,paperwidth} % <- Any solution to just add "main,savepos,thepage..."

\NewDocumentCommand\subproofMarkStart{m}{% \zref@labelbylist{#1}{subproof}% } \NewDocumentCommand\subproofMarkStop{m}{% \zref@labelbylist{#1}{subproof}% }

\makeatother \author{}

\begin{document}

Hello \subproofMarkStart{blibli}

\zref[abspage]{blibli}

The counter of blibli is \zref[counter]{blibli} (why is it empty?), the position is \zposx{blibli} (why??) The paper width is \zref[paperwidth]{blibli}

I would expect to see a line drawn: \begin{tikzpicture}[remember picture, overlay] \draw (current page.north west) -- ([xshift=\zposx{blibli}sp,yshift=\zposy{blibli}sp]current page.south west); \end{tikzpicture} \end{document}

tobiasBora
  • 8,684
  • 1
    you need \zref@savepos\zref@labelbylist{#1}{subproof} for the position. And counter can only store something if a counter has been set before. – Ulrike Fischer Feb 03 '22 at 16:30
  • Thanks! But how am I supposed to set the counter? Should I redefine \@currentcounter manually before the call to labelbylist? – tobiasBora Feb 03 '22 at 16:42
  • 1
    why should you set it? The property is there to tell you if and which counter has been set. If it is empty it means you didn't change a counter yet. If you add e.g. \section{blub} this will change. – Ulrike Fischer Feb 03 '22 at 16:48
  • Ah ok, then I misunderstood it's usage,I thought it was made to count the number of labels that were defined. I guess I need my own prop then. Btw, I also wanted to ask: is it possible to use zref to maintain the list of all label names that were defined in the file, or should I manually write in the aux file? I basically want to loop over all labels of a certain kind. – tobiasBora Feb 03 '22 at 17:04

0 Answers0