I'm trying to make my algorithm more readable in LaTeX:
\documentclass{IEEEtran} \usepackage{algpseudocode} \usepackage{algorithm} \begin{document} \begin{algorithm}[H] \caption{Detecta \textit{Slowloris}} \begin{algorithmic}[1] \Function{Divide\_slices\_1min }{Arquivo PCAP} \State \Return \textit{sliceAtual} \EndFunction \Function{Separa\_IP\_Origem\_Destino}{sliceAtual} \State \Return $ArquivoIPs$ \EndFunction \Function{Calcula\_entropia\_IP\_Origem\_Destino}{ArquivoIP} \State \Return $EntroSliceAtualIP$ \EndFunction \Function{PVS}{sliceAtual} \State \Return $PVS_SliceAtual$ \EndFunction \Function{FCS}{sliceAtual} \State \Return $FCS_SliceAtual$ \EndFunction \If {$entropiaSliceAtual$ > $entropiaSemAtaq$ + 0,10*$entropiaSemAtaq$} \If {$PVS_SliceAtual$ > $PVS_SemAtaq$ + 0.60*$PVS_SemAtaq$} \If {$FCS_SliceAtual$ > $FCS_SemAtaq$ - 0.40*$FCS_SemAtaq$} \State \Return $Ataque$ \Else \State \Return $SemAtaques$ \EndIf \EndIf \EndIf \end{algorithmic} \end{algorithm} \end{document}
The result was not so good:
I would like it to appear just the call to the functions without the lot of endif.
I would like something like this:
Any suggestion? I am trying hard! The classe IEEEtran is : https://ctan.org/pkg/ieeetran?lang=en
1 Answers
Answers 1
— So you just want to remove the 3
end if
s?
— Yes, all "ends":end if
,end function
.
If so, you just need to replace
\usepackage{algpseudocode}
with
\usepackage[noend]{algpseudocode}
Sources:
- paragraph 3.1.9 in algorithmics.pdf
- lines 66–74 in algpseudocode.sty
0 comments:
Post a Comment