0

I am very new to Latex. I have problem with \SetAlgoLined in algorithm2e. As seen from the picture, inside the while loop the line seem to be normal. I don't know why outside the while loop, the line seem strange.

\documentclass{article}
\usepackage[ruled,vlined,algo2e]{algorithm2e}
\begin{document}
\begin{algorithm2e}
  \SetAlgoLined
  \SetKwInOut{Input}{Subscribe}\SetKwInOut{Output}{Publish}
  \SetKw{Set}{set}
 \SetKw{Read}{read}
 \SetAlFnt{\large}
 \SetAlCapFnt{\large}
 \SetAlCapNameFnt{\large}
 \caption{Single Robot Auto Navigation}

  \Input{initialize\_state, custom\_waypose ($q_i,\alpha_i$), robot\_status, camera\_interrupt, object\_depth}
  \Output{robot\_pose ($p_i,\alpha_i$), sphere\_marker\_position ($q$) }
  
  \If{finished initialize\_state}{
     \Read {custom\_waypose}\;
  \For{waypoint ($q_i$) in custom\_waypose:}{
    \For{wayorientation ($\theta_i$) in custom\_waypose:}{
        \Set{WAIT to robot\_status}\;
         $p_i = q_i$\; 
         $\theta_i = \alpha_i$\;
        return waypose\;
    \While{waiting robot\_status}{
      \If {robot reached goal}{
            break\;}          
            
    \If {camera_interrupt}{
    $q_i_x = p_i_x+ object\_depth * sin(\theta_i)$\;
    $q_i_y = p_i_y+ object\_depth * cos(\theta_i)$ \;
    return sphere marker (q)\;
    end program\;
    }
    }
    }
    }
    }
\end{algorithm2e}
\end{document}

Inside the while loop the line seem to be normal. I don't know why outside the while loop, the line seem strange.

1 Answer 1

0

Your code gives multiple errors. Solving them, solves your problem.

  1. Missing $ inserted.
  • camera_interrupt -> camera\_interrupt
  1. 4 times Double subscript
\documentclass{article}
\usepackage[ruled,vlined,algo2e]{algorithm2e}
\begin{document}
\begin{algorithm2e}
    \SetAlgoLined
    \SetKwInOut{Input}{Subscribe}\SetKwInOut{Output}{Publish}
    \SetKw{Set}{set}
    \SetKw{Read}{read}
    \SetAlFnt{\large}
    \SetAlCapFnt{\large}
    \SetAlCapNameFnt{\large}
    \caption{Single Robot Auto Navigation}

  \Input{initialize\_state, custom\_waypose ($q_i,\alpha_i$), robot\_status, camera\_interrupt, object\_depth}
  \Output{robot\_pose ($p_i,\alpha_i$), sphere\_marker\_position ($q$) }
  
  \If{finished initialize\_state}{
     \Read {custom\_waypose}\;
  \For{waypoint ($q_i$) in custom\_waypose:}{
    \For{wayorientation ($\theta_i$) in custom\_waypose:}{
        \Set{WAIT to robot\_status}\;
         $p_i = q_i$\; 
         $\theta_i = \alpha_i$\;
        return waypose\;
    \While{waiting robot\_status}{
      \If {robot reached goal}{
            break\;}          
            
    \If {camera\_interrupt}{
    $q_{i_x} = p_{i_x}+ object\_depth * sin(\theta_i)$\;
    $q_{i_y} = p_{i_y}+ object\_depth * cos(\theta_i)$ \;
    return sphere marker (q)\;
    end program\;
    }
    }
    }
    }
    }
\end{algorithm2e}
\end{document}
1
  • Thank you so much for your help! Commented Jun 14, 2023 at 8:28

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.