I am struggling with moving the caption's location to the left.
Is there a way to fix the alignment of the caption in the algorithm?
Below are some of the packages that I used and the code.
Thanks.
\usepackage[ruled, lined, linesnumbered, commentsnumbered, resetcount, longend]{algorithm2e}
\usepackage{algpseudocode}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\begin{algorithm}
\caption{Offine Algorithm}\label{alg:offline}
\SetKwFunction{Send}{Send}
\SetKwFunction{Receive}{Receive}
\SetKwFunction{Verify}{Verify}
\SetKwFunction{Broadcast}{Broadcast}
\SetKwFunction{Store}{Store}
\SetKwInOut{KwIn}{Input}
\SetKwInOut{KwOut}{Output}
Best Answer
A solution that worked
Add the code line:
right before
in your code to remove the horizontal space before the caption.
The full code example is:
After you compile and run the code, it will look like this:
Sources
This solution is taken from page 23 of the
algorithm2e
package documentation, which you can find at https://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/algorithm2e/doc/algorithm2e.pdf or access through https://ctan.org/pkg/algorithm2e?lang=en.On this page, it says that
You might find some additional useful macros there to boost your project.
Good luck!