That’s correct, it’s actually a bit subtle, thanks for reporting it.
The solution
In your utils.jl
copy-paste this:
function lx_nonumber(com, _)
Franklin.PAGE_EQREFS[Franklin.PAGE_EQREFS_COUNTER] -= 1
return "@@nonumber " * Franklin.content(com.braces[1]) * "@@"
end
in your *.css
paste similar to the doc linked in the earlier comment:
.nonumber .katex-display::after {
counter-increment: nothing;
content: "";
}
Now if you have something like this:
$$
x = 1 \label{eq1}
$$
\nonumber{
$$
x = 2
$$
}
$$
x = 3 \label{eq2}
$$
\eqref{eq1} and \eqref{eq2}
It will show this:
(the vertical alignment is something different that can be adjusted by fiddling with CSS but I’m assuming this is not your most immediate concern; edit see note at the bottom though)
A bit of background
The solution with the CSS is only a trick with the CSS displaying a counter; that CSS counter is not read by Franklin. Franklin instead keeps track of all the equation labels for a page in a dictionary PAGE_EQREFS
which has a special entry PAGE_EQREFS_COUNTER
which gets incremented every time a display math block is seen.
This procedure is blind to the fact that you wrapped the block in a div with a class that does some CSS tricks; and so, as you pointed out, the refs are incorrect (in the example above you would have gotten (2) and (4)
even though the third equation showed with a (3)
.
The lx_nonumber
adjusts the counter accordingly.
I hope this makes sense; I might bake this into Franklin since other users might want to use something like this and the solution is not directly obvious. I’ll open an issue with this Equations without numbers and eqref · Issue #939 · tlienart/Franklin.jl · GitHub.
css trickery
edit if you use
.nonumber .katex-display::after {
counter-increment: nothing;
content: "\00a0\00a0\00a0\00a0";
}
the vertical alignment issue in the example above will be fixed if you only have single-digit equations. The \00a0
is an escaped space (oh the wonderful world of css…)