SaswatPadhi / pseudocode.js

Beautiful pseudocode for the Web
https://saswatpadhi.github.io/pseudocode.js
MIT License
221 stars 33 forks source link

Completely hide caption prefix #50

Closed HaydarJawad closed 3 months ago

HaydarJawad commented 3 months ago

Great package I love it thank you ! is there a way force the Algorithm 1 part of the caption to my own words ? Algorithm 1 New Quicksort

Regards Haydar

SaswatPadhi commented 3 months ago

Hi Haydar,

You could use the titlePrefix option to override that. I had introduced it in 69528e9bf5ecbacbe5f4094ca61c654fdf85f71b, but I just noticed that it's not mentioned in the README.md file. I will add it under https://github.com/SaswatPadhi/pseudocode.js/blob/master/README.md#global-options.

HaydarJawad commented 3 months ago

Thank you mate, I tried this and now I keep getting (1) when I render the html on the browser instead of nothing ?

I want to decide the title myself, Regards Haydar Start :

<!DOCTYPE html>

Pseudocode Example

Quicksort

        % This quicksort algorithm is extracted from Chapter 7, Introduction to Algorithms (3rd edition)
        \begin{algorithm}
        \caption{}
        \begin{algorithmic}
        \PROCEDURE{Quicksort}{$A, p, r$}
            \IF{$p < r$}
                \STATE $q = $ \CALL{Partition}{$A, p, r$}
                \STATE \CALL{Quicksort}{$A, p, q - 1$}
                \STATE \CALL{Quicksort}{$A, q + 1, r$}
            \ENDIF
        \ENDPROCEDURE
        \PROCEDURE{Partition}{$A, p, r$}
            \STATE $x = A[r]$
            \STATE $i = p - 1$
            \FOR{$j = p$ \TO $r - 1$}
                \IF{$A[j] < x$}
                    \STATE $i = i + 1$
                    \STATE exchange $A[i]$ with $A[j]$
                \ENDIF
            \ENDFOR
            \STATE exchange $A[i]$ with $A[r]$
        \ENDPROCEDURE
        \end{algorithmic}
        \end{algorithm}
    

ENd On Fri, 31 May 2024 at 06:28, Saswat Padhi @.***> wrote:

Hi Haydar,

You could use the titlePrefix option to override that. I had introduced it in 69528e9 https://github.com/SaswatPadhi/pseudocode.js/commit/69528e9bf5ecbacbe5f4094ca61c654fdf85f71b, but I just noticed that it's not mentioned in the README.md file. I will add it under https://github.com/SaswatPadhi/pseudocode.js/blob/master/README.md#global-options .

— Reply to this email directly, view it on GitHub https://github.com/SaswatPadhi/pseudocode.js/issues/50#issuecomment-2141257501, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETEP7M6QZPJ7EWDFWKOVGDZFADATAVCNFSM6AAAAABIOWJLV2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBRGI2TONJQGE . You are receiving this because you authored the thread.Message ID: @.***>

SaswatPadhi commented 3 months ago

Hi,

I understand your question now. To completely hide the caption prefix, you could add the following do your <style>:

.ps-algorithm.with-caption > .ps-line > .ps-keyword {
  display: none;
}

You also don't need to override the titlePrefix or the captionCount.

Here is an example: https://jsfiddle.net/sx374h1b/

HaydarJawad commented 3 months ago

Thank you mate, that's exactly what I wanted. Regards Haydar

On Sun, 2 Jun 2024 at 21:52, Saswat Padhi @.***> wrote:

Hi,

I understand your question now. To completely hide the caption, you could add the following do your