I am trying to apply solution in Include a line break in algorithmic while maintaining indentation for the lines starting with if. But then does not carried out to breaked line.
\documentclass{article}
\usepackage{algorithm}% http://ctan.org/pkg/algorithm
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\makeatletter
\let\OldStatex\Statex
\renewcommand{\Statex}[1][3]{%
\setlength\@tempdima{\algorithmicindent}%
\OldStatex\hskip\dimexpr#1\@tempdima\relax}
\makeatother
\begin{document}
\section{Struttura dati}
\begin{algorithm}
\caption{Leggi file .gpx}\label{getgpx}
\begin{algorithmic}[1]
\If{x=10 \textbf{and}}
\Statex y=10
\State speed~$\gets$~computeSpeed(
\Statex gpx.track(i).segment(j).delta\_s(q),
\Statex[2] gpx.track(i).segment(j).delta\_t(q));
\EndIf
\end{algorithmic}
\end{algorithm}
\end{document}
output:
Wanted output:
1: if x=10 and
y=10 then
2: speed ← computeSpeed(...


\usepackage[noend]{algpseudocode}to preventend ifto show up. Is it possible to suppress end if to printed in your solution as well? I have removed\algorithmicend\ \algorithmicifbut now it prints empty-line instead ; I am sorry I forget to mention this in my original question – alper Dec 10 '22 at 13:45\algtext*{EndIf}just after the\algdefdefinition ofmultilineIf. – Werner Dec 11 '22 at 06:10algpseudocodewithout end block text. – Werner Dec 11 '22 at 17:17