# How to put \value{counter} as value to .aux file?

I'm trying to customize eledmac settings in a way that I can use its footnote ability just like the ordinary LaTeX footnote style, but not as one paragraph per footnote but all footnotes in one paragraph. My problem is now to get the footnote mark into the footnote text apparatus, since eledmac is used to put line number and lemma there instead of footnote marks.

As a result, if I use \value{footnote} somewhere in the second argument of \edtext, I only get the last (highest) footnote number because eledmac will typeset the footnote apparatus when finalizing the page instead of instantly inserting footnotes that would reflect the current footnote counter value.

In order to fix this, I've already set up a little label/reference command that will memorize the footnote mark number in the .aux file. This seems to work as long as I put hard coded footnote numbers into it, but if I pass \value{footnote} to it, \value{footnote} gets into the .aux file, which again results in the last (highest) footnote number of the page.

Is there a way to resolve \value{footnote} to its actual value for the .aux file? What could I do instead, if there's no way for doing so? Here a screenshot of the PDF:

(source: freie-bibel.de)

Here an example:

\documentclass[a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage{ngerman}
\usepackage{eledmac}
\usepackage{perpage}
\usepackage{zref-user}

\setlength{\parskip}{0pt}

\numberlinefalse
\footparagraph{A}
\nonumberinfootnote

\MakePerPage{footnote}

\makeatletter
\zref@newprop{myfootnote}[0]{0}

\newcommand*{\footnotemarkref}[1]
{
\zref@extractdefault{#1}{myfootnote}{0}
}

\newcommand*{\footnotemarklabel}[1]
{
\zref@setcurrent{myfootnote}{\value{footnote}}
\zref@labelbyprops{#1}{myfootnote}
}
\makeatother

\begin{document}
\beginnumbering
\pstart
Dieses\edtext{\addtocounter{footnote}{1}\footnotemark[\footnotemarkref{footnote:1:2:1}]}{\lemma{\footnotemark[\footnotemarkref{footnote:1:2:1}] 1,2}\Afootnote{\footnotemarklabel{footnote:1:2:1}O. Er.}} war im Anfang bei Gott.
Alles ward durch dasselbe,\edtext{\addtocounter{footnote}{1}\footnotemark[\footnotemarkref{footnote:1:3:1}]}{\lemma{\footnotemark[\footnotemarkref{footnote:1:3:1}] 1,3}\Afootnote{\footnotemarklabel{footnote:1:3:1}O. ihn.}} und ohne dasselbe ward auch nicht eins, das geworden ist.
\pend
\endnumbering
\end{document}


The lines in the .aux file are:

\zref@newlabel{footnote:1:2:1}{\myfootnote{\c@footnote }}
\zref@newlabel{footnote:1:3:1}{\myfootnote{\c@footnote }}


Where I would rather have something like this:

\zref@newlabel{footnote:1:2:1}{\myfootnote{1 }}
\zref@newlabel{footnote:1:3:1}{\myfootnote{2 }}


Additionally, if you know where the space before the footnote mark in the text area are coming from, please let me know. Thanks in advance!

• I'm not sur to understand well your need. Do you want to make crossref to critical footnote ? If yes, I think it should be an feature of eledmac. Please open an issue. I will correct after my holidays. Or do you want to have lemma with footnote which doesn't say list number but an incremental number ? If yes, I think it could be also an issue, and so open an feature on github. If it's an other problem, could you explain it again ? Jul 30, 2013 at 23:56
• I think, in it's current state, this is more a comment than an answer. Jul 31, 2013 at 1:03
• I'm developing a XSLT stylesheet which will automatically transform a Bible text from XML to LaTeX using eledmac. We have already archieved working XSLT stylesheets using other LaTeX packages - eledmac may reduce the need of manual labour which those other solutions require and may provide additional features. Here I'm "abusing" eledmac for footnotes, where Bible texts are not referenced by line but (book), chapter and verse. One verse may contain more than one footnote at a specific position, where sometimes it could not be determined to which word(s) it belongs (so no lemma). Jul 31, 2013 at 22:46
• Hum, I think, you should use one line number by verse, like it's doing in github.com/maieul/ledmac/issues/112#issuecomment-20011279. Aug 1, 2013 at 15:12
• So you would have a reference by verse. Or I don't understand what you exactly need (I'm sorry, but I'm french) Aug 1, 2013 at 15:13

I'm not entirely sure whether this answers your question: You can use the \zref@wrapper@immediate macro to expunge things immediately to the .aux. From the zref documentation (section 2.8 Wrapper for advanced situations, p 10):

\zref@wrapper@immediate{...}

There are situations where a label must be written instantly to the .aux file, for example after the last page. If the \zlabel or \label command is put inside this wrapper, immediate writing is enabled.

However, some macro shuffling allows you to get around it. Here's the complete MWE:

\documentclass[a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage{ngerman}
\usepackage{eledmac}
\usepackage{perpage}
\usepackage{zref-user}

\setlength{\parskip}{0pt}

\numberlinefalse
\footparagraph{A}
\nonumberinfootnote

\MakePerPage{footnote}

\makeatletter
\zref@newprop{myfootnote}[0]{\thefootnote}

\newcommand*{\footnotemarkref}[1]
{%
\zref@extractdefault{#1}{myfootnote}{0}%
}

\newcommand*{\footnotemarklabel}[1]
{%
\zref@labelbyprops{#1}{myfootnote}%
}
\makeatother

\begin{document}
\beginnumbering
\pstart
Dieses\edtext{\stepcounter{footnote}\footnotemarklabel{footnote:1:2:1}\footnotemark[\footnotemarkref{footnote:1:2:1}]}{\lemma{\footnotemark[\footnotemarkref{footnote:1:2:1}] 1,2}\Afootnote{O. Er.}} war im Anfang bei Gott.
Alles ward durch dasselbe,\edtext{\stepcounter{footnote}\footnotemarklabel{footnote:1:3:1}\footnotemark[\footnotemarkref{footnote:1:3:1}]}{\lemma{\footnotemark[\footnotemarkref{footnote:1:3:1}] 1,3}\Afootnote{O. ihn.}} und ohne dasselbe ward auch nicht eins, das geworden ist.
\pend
\endnumbering
\end{document}


with the output in the .aux now containing:

\zref@newlabel{footnote:1:2:1}{\myfootnote{1}}
\zref@newlabel{footnote:1:3:1}{\myfootnote{2}}


Note that I've shuffled around the use of some commands within your document, as well as include some end-of-line % to avoid spurious spaces. See What is the use of percent signs (%) at the end of lines?

• I do not see that \zref@wrapper@immediate is needed here. Also the explicit setting \zref@setcurrent{myfootnote}{\thefootnote} can be put into the property: \zref@newprop{myfootnote}[0]{\thefootnote} Jul 30, 2013 at 22:04
• @HeikoOberdiek: You're right... my update of the macro order avoids using \zref@wrapper@immediate. I'll also update with the property default...
– Werner
Jul 30, 2013 at 23:57
• Thanks for your answer, it solved all issues. I looked at the zref documentation, but because of lack of understanding enough LaTeX terminology I didn't look after this specific description. Thanks again, those hints were of real value for me. Jul 31, 2013 at 22:51