fix ref issues

This commit is contained in:
matthias@quintern.xyz 2025-02-23 10:19:47 +01:00
parent 16aacd72d8
commit d803b2308a
3 changed files with 23 additions and 12 deletions

View File

@ -123,11 +123,11 @@
\ttxt{\eng{
Applies a L2 norm penalty on the weights.
This ensures unimportant features are less regarded and do not encode noise.
\\Corresponds to assuming a \fqEqRef{math:pt:bayesian:prior} \absRef{multivariate_normal_distribution} with $\vec{mu} = 0$ and independent components ($\mat{\Sigma}$) for the weights.
\\Corresponds to assuming a \fqEqRef{math:pt:bayesian:prior} \absRef{multivariate_normal_distribution} with $\vec{\mu} = 0$ and independent components ($\mat{\Sigma}$) for the weights.
}\ger{
Reduziert Gewichte mit der L2-Norm.
Dadurch werden unwichtige Features nicht berücksichtigt (kleines Gewicht) und enkodieren nicht Noise.
\\Entspricht der Annahme einer \absRef[Normalverteilung]{multivariate_normal_distribution} mit $\vec{mu}=0$ und unanhängingen Komponenten ($\mat{Sigma}$ diagonaol) der die Gewichte als \fqEqRef{math:pt:bayesian:prior}.
\\Entspricht der Annahme einer \absRef[Normalverteilung]{multivariate_normal_distribution} mit $\vec{\mu}=0$ und unanhängingen Komponenten ($\mat{Sigma}$ diagonaol) der die Gewichte als \fqEqRef{math:pt:bayesian:prior}.
}}
\end{formula}

View File

@ -54,6 +54,9 @@
% Class defining commands shared by all formula environments
% 1: key
\newenvironment{formulainternal}[1]{
% TODO refactor, using fqname@enter and leave
% TODO There is no real need to differentiate between fqnames and sections,
% TODO thus change the meaning of f: from formula to fqname and change sec to f
% [1]: language
% 2: name
% 3: description
@ -70,12 +73,12 @@
% [1]: label to use
% 2: Abbreviation to use for references
\newcommand{\abbrLabel}[2][#1]{
\abbrLink[f:\fqname]{##1}{##2}
\abbrLink[f:\fqname:#1]{##1}{##2}
}
% makes this formula referencable with \absRef{<name>}
% [1]: label to use
\newcommand{\absLabel}[1][#1]{
\absLink[f:\fqname]{##1}
\absLink[\fqname:#1]{f:\fqname:#1}{##1}
}
\newcommand{\newFormulaEntry}{

View File

@ -167,11 +167,19 @@
absLabels = absLabels or {}
abbrLabels = abbrLabel or {}
}
% [1]: target (fqname to point to)
% 2: key
\newcommand{\absLink}[2][sec:\fqname]{
% [1]: translation key, if different from target
% 2: target (fqname to point to)
% 3: key
\newcommand{\absLink}[3][\relax]{
\directLuaAuxExpand{
absLabels["#2"] = [[#1]]
absLabels["#3"] = {}
absLabels["#3"]["fqname"] = [[#2]]
absLabels["#3"]["translation"] = [[#1]] or [[#2]]
% if [[#1]] == "" then
% absLabels["#3"]["translation"] = [[#2]]
% else
% absLabels["#3"]["translation"] = [[#1]]
% end
}
}
% [1]: target (fqname to point to)
@ -186,15 +194,15 @@
}
% [1]: text
% 2: key
\newrobustcmd{\absRef}[2][\relax]{%
\newcommand{\absRef}[2][]{%
\directlua{
if absLabels["#2"] == nil then
tex.sprint(string.sanitize(\luastring{#2}) .. "???")
else
if "#1" == "" then %-- if [#1] is not given, use translation of key as text, else us given text
tex.sprint("\\hyperref[" .. absLabels["#2"] .. "]{\\GT{" .. absLabels["#2"] .. "}}")
if \luastring{#1} == "" then %-- if [#1] is not given, use translation of key as text, else us given text
tex.sprint("\\hyperref[" .. absLabels["#2"]["fqname"] .. "]{\\GT{" .. absLabels["#2"]["translation"] .. "}}")
else
tex.sprint("\\hyperref[" .. absLabels["#2"] .. "]{\luaescapestring{#1}}")
tex.sprint("\\hyperref[" .. absLabels["#2"]["fqname"] .. "]{\luaescapestring{#1}}")
end
end
}