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 Answers1

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}

dexteritas
  • 9,161