TeX - LaTeX Asked by Morteza Alinia on January 27, 2021
documentclass[twocolumn]{autart}
usepackage{algpseudocode}
usepackage{algorithm}
usepackage{amsmath}
usepackage{graphicx}
begin{document}
begin{figure}
label{Fig1}
begin{algorithm}[H]
1: textbf{for} each mode $ihspace{0.08cm}epsilon hspace{0.08cm}mathcal I$ textbf{do}
2: hspace{0.8cm}$Omega_i^0=mathcal{X}_i$
3: textbf{end for}
4: textbf{repeat}
5: textbf{for} each mode $ihspace{0.08cm}epsilon hspace{0.08cm}mathcal I$ textbf{do}
caption{My Pseudocode }
end{algorithm}
caption{My Figure Caption .}
end{figure}
As Figure.~ref{Fig1} mentions
end{document}
You load the package algpseudocode
anyway, so let's use it. See the documentation of the package algorithmicx
for details.
Side-note: For the 'is-element-of' relation, there is the TeX command in
. If you don't like the symbol, one can change it, but it is not advisable to use something like hspace{0.08cm}epsilon hspace{0.08cm}
instead.
documentclass{article}
usepackage{algpseudocode}
usepackage{algorithm}
begin{document}
begin{algorithm}
begin{algorithmic}[1]
For{each mode $iinmathcal I$}
State $Omega_i^0=mathcal{X}_i$
EndFor
Repeat
For{each mode $iinmathcal I$}
EndFor
Until{bored}
end{algorithmic}
caption{My Pseudocode }
label{Fig1}
end{algorithm}
See Algorithm~ref{Fig1}.
end{document}
If you prefer to refer to the algorithm as a figure, I suggest to replace algorithm
by figure
, but not to nest them.
documentclass{article}
usepackage{algpseudocode}
begin{document}
begin{figure}
begin{algorithmic}[1]
For{each mode $iinmathcal I$}
State $Omega_i^0=mathcal{X}_i$
EndFor
Repeat
For{each mode $iinmathcal I$}
EndFor
Until{bored}
end{algorithmic}
caption{My Pseudocode }
label{Fig1}
end{figure}
See Figure~ref{Fig1}.
end{document}
Answered by gernot on January 27, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP