- Notifications
You must be signed in to change notification settings - Fork33
Open
Description
Just wondering if algorithms can be references as a hyperlinks as, for example, Equations. For example, the below latex equation could be referenced throughout a document, with the number being a hyperlink to the equation.
\begin{align}x = 1\label{eq:equation}\end{align}
If I try adding something similar to analgorithm
environment (whether insider thealgorithm
oralgorithmic
environments), the algorithm does not compile, and as a result, does not show up on my webpage. That is, if I remove \label{alg:grad_descent}
from the code below, the pseudocode block compiles and shows up.
<preid="eq:grad_descent"class="pseudocode"data-line-number=true> \begin{algorithm} \caption{Gradient Descent} \begin{algorithmic} \label{alg:grad_descent} \REQUIRE{Function for computing loss function, $\ell_{MSE}$ (see Equation $\ref{eq:mse-matrix}$)} \INPUT{Initial guess for weights $\mathbf{w}^{(0)}$} \PROCEDURE{gradientDescent}{$K, \epsilon, \tau$} \STATE{$k = 0$} \WHILE{$k<K$\AND$\lVert\mathbf{w}^{(k)}-\mathbf{w}^{(k+1)}\rVert^2_2< \epsilon$} \STATE{$\mathbf{w}^{(k+1)} =\mathbf{w}^{(k)}-\tau\nabla_{\mathbf{w}}\ell_{MSE}(\mathbf{w}^{(k)})$.}\STATE{$k\mathrel{+}=1$}\ENDWHILE\ENDPROCEDURE\end{algorithmic}\end{algorithm}</pre>
Here is how I callpseudocode.js
( I call is internally, given that I am using MathJax 4.0.0-beta3).
<scriptsrc="https://cdn.jsdelivr.net/npm/mathjax@4.0.0-beta.3/tex-chtml.js"integrity="sha256-ljPODBK7Jf/VfUrVqec63xzZbysEmwB9Ab20TWRMQRU="crossorigin="anonymous"></script><linkrel="stylesheet"href="https://cdn.jsdelivr.net/npm/pseudocode@2.4.1/build/pseudocode.min.css"><scriptsrc="https://cdn.jsdelivr.net/npm/pseudocode@2.4.1/build/pseudocode.min.js"></script><scriptsrc="{{"js/pseudocode.js" | relURL }}"></script>
Metadata
Metadata
Assignees
Labels
No labels