3

Problem:

I am using parskip (only) to add customized space between paragraphs, but the package is shifting my algorithm content to the left.

If there is another (clean) way to customize the space between paragraphs or isolate the algorithm environment, it is welcome:

How does it looks:

enter image description here

And here the same code without parskip

enter image description here

The code:

\documentclass{report}
\usepackage{xcolor}
\usepackage{parskip}
\newcommand{\bftab}{\fontseries{b}\selectfont}
\usepackage[linesnumbered,ruled,vlined,spanish,onelanguage]{algorithm2e}

\begin{document}

    \begin{algorithm}
    \caption{SomeTitle}
    \DontPrintSemicolon
    \footnotesize
        delRef(Refutation ref)\{\;
            \Indp
            Some code lines\;
            Other one\;
            \Indm
        \}\;
    \end{algorithm}

\end{document}

As always, thank you so much for your time :)

2

the documentation says that indents depend on the existing \parindent and \leftskip when the package is loaded.

so try loading parskip after algorithm2e.

| improve this answer | |
2

Looks like the algorithm layout is assuming that \parindent is non zero. If you set it locally back to say 15pt, then the text is indented by that amount

\documentclass{report}
\usepackage{xcolor}
\usepackage{parskip}
\newcommand{\bftab}{\fontseries{b}\selectfont}
\usepackage[linesnumbered,ruled,vlined,spanish,onelanguage]{algorithm2e}

\begin{document}

    \begin{algorithm}\setlength\parindent{15pt}
    \caption{SomeTitle}
    \DontPrintSemicolon
    \footnotesize
        delRef(Refutation ref)\{\;
            \Indp
            Some code lines\;
            Other one\;
            \Indm
        \}\;
    \end{algorithm}

\end{document}
| improve this answer | |
  • great, thank you. Just a little detail, the title still being shifted. Is there something for that? – onlycparra Mar 18 '16 at 16:33
  • @onlycparra -- as i noted in a comment to your other question, the documentation says that indents depend on the existing \parindent and \leftskip` when the package is loaded. so try loading parskip after algorithm2e. – barbara beeton Mar 18 '16 at 16:45
  • @barbarabeeton reading the documentation is cheating:-) – David Carlisle Mar 18 '16 at 16:46
  • [EDITED] as I commented him back (lol) the problem still happening even without parsnip at all. EDIT: sorry, I get confused with the other question, please forget this comment. I will try it – onlycparra Mar 18 '16 at 16:47
  • Done, loading parskip before solves the problem, please post an answer :) – onlycparra Mar 18 '16 at 16:51

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.