Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Algorithm numbers as hyperlinks #45

Open
@sebsciarra

Description

@sebsciarra

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp