4

Here is my code:

\documentclass[11pt]{llncs}
\usepackage[utf8]{inputenc}
\usepackage{parskip}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{float}
\usepackage{multicol}
\usepackage{fixltx2e}
\usepackage{multicol}
\newcommand\blfootnote[1]{%
  \begingroup
  \renewcommand\thefootnote{}\footnote{#1}%
  \addtocounter{footnote}{-1}%
  \endgroup
  }

\usepackage[T1]{fontenc}
\usepackage{comment} 
\usepackage{amsmath}                                    % 
\setcounter{MaxMatrixCols}{20}
\usepackage[margin=1in]{geometry}
\usepackage[noend, boxruled, linesnumbered]{algorithm2e}
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{hyperref}
\definecolor{bl}{rgb}{0.0,0.2,0.6} 
\definecolor{dark-red}{rgb}{0.4,0.15,0.15}
\definecolor{dark-blue}{rgb}{0.15,0.15,0.4}
\definecolor{medium-blue}{rgb}{0,0,0.5}
\usepackage{sectsty}
\hypersetup{
    colorlinks, linkcolor={dark-red},
    citecolor={dark-blue}, urlcolor={medium-blue}
}
\usepackage{graphicx}
\usepackage[compact]{titlesec} 
\newtheorem{observation}{\textsc{Observation}}
%%% Start of the document
\begin{document}
\begin{algorithm}[H]
\label{alg:seed}
    \SetAlgoLined
     \SetKwInOut{Input}{input}
    \Input{\textsc{Graph} $G$}
    line number outside the box\;
    another line\;
    a third line\;
    what is going on?\;
    \caption{\textsc{Caption}}
\end{algorithm}
\end{document}

And here is the output: enter image description here

Which command sends line numbers outside of the box?

2 Answers 2

6

You can use algorithm2e and parskip in the same document if you load algorithm2e first:

\usepackage[noend, boxruled, linesnumbered] {algorithm2e}
\usepackage{parskip}

enter image description here

Code:

\documentclass[11pt]{llncs}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{float}
\usepackage{multicol}
\usepackage{fixltx2e}
\usepackage{multicol}
\newcommand\blfootnote[1]{%
  \begingroup
  \renewcommand\thefootnote{}\footnote{#1}%
  \addtocounter{footnote}{-1}%
  \endgroup
  }

\usepackage[T1]{fontenc}
\usepackage{comment} 
\usepackage{amsmath}
\setcounter{MaxMatrixCols}{20}
\usepackage[margin=1in]{geometry}
%
\usepackage[noend, boxruled, linesnumbered] {algorithm2e}
\usepackage{parskip}
%
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{hyperref}
\definecolor{bl}{rgb}{0.0,0.2,0.6} 
\definecolor{dark-red}{rgb}{0.4,0.15,0.15}
\definecolor{dark-blue}{rgb}{0.15,0.15,0.4}
\definecolor{medium-blue}{rgb}{0,0,0.5}
\usepackage{sectsty}
\hypersetup{colorlinks, linkcolor={dark-red},
citecolor={dark-blue}, urlcolor={medium-blue}}
\usepackage{graphicx}
\usepackage[compact]{titlesec} 
\newtheorem{observation}{\textsc{Observation}}

\usepackage{blindtext}% dummy text
% Start of the document
\begin{document}
\begin{algorithm}[H]
\label{alg:seed}
    \SetAlgoLined
    \SetKwInOut{Input}{input}
    \Input{\textsc{Graph} $G$}
    line number outside the box\;
    another line\;
    a third line\;
    what is going on?\;
    \caption{\textsc{Caption}}
    return
\end{algorithm}
\blindtext

\blindtext
\end{document}
3

I don't know what causes the conflict, my study shows that removing the parkskip package will send the line number into the box.

enter image description here

\documentclass[11pt]{llncs}
\usepackage[utf8]{inputenc}
%\usepackage{parskip}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{float}
\usepackage{multicol}
\usepackage{fixltx2e}
\usepackage{multicol}
\newcommand\blfootnote[1]{%
  \begingroup
  \renewcommand\thefootnote{}\footnote{#1}%
  \addtocounter{footnote}{-1}%
  \endgroup
  }

\usepackage[T1]{fontenc}
\usepackage{comment} 
\usepackage{amsmath}                                    % 
\setcounter{MaxMatrixCols}{20}
\usepackage[margin=1in]{geometry}
\usepackage[noend, boxruled, linesnumbered] {algorithm2e}
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{hyperref}
\definecolor{bl}{rgb}{0.0,0.2,0.6} 
\definecolor{dark-red}{rgb}{0.4,0.15,0.15}
\definecolor{dark-blue}{rgb}{0.15,0.15,0.4}
\definecolor{medium-blue}{rgb}{0,0,0.5}
\usepackage{sectsty}
\hypersetup{colorlinks, linkcolor={dark-red},
citecolor={dark-blue}, urlcolor={medium-blue}}
\usepackage{graphicx}
\usepackage[compact]{titlesec} 
\newtheorem{observation}{\textsc{Observation}}
%%% Start of the document
\begin{document}
\begin{algorithm}[H]
\label{alg:seed}
    \SetAlgoLined
    \SetKwInOut{Input}{input}
    \Input{\textsc{Graph} $G$}
    line number outside the box\;
    another line\;
    a third line\;
    what is going on?\;
    \caption{\textsc{Caption}}
    return
\end{algorithm}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.