I'm using algorithm2e for typesetting pseudocode. Generally I find it easy to use, however, I cannot seem to find the setting that underlines the conditions in my while and for loops and if-statements.
\begin{algorithm}[H]
\LinesNumbered
\SetAlgoNoLine
\DontPrintSemicolon
\KwData{New relation $m_i(r_{new})m_j$}
\KwResult{An updated network where consequences of the new relation is inferred.}
\BlankLine
Add $(i,j)$ to Q\;
\While{Q is not empty} {
(i, j) $\leftarrow$ Q.dequeue\;
\For{k $\leftarrow$ 0 $\KwTo$ n} {
$m_k(r_{new})m_j$ $\leftarrow$ $m_k(r)m_j \cup (m_k(r)m_i \circ m_i(r_{new})m_j)$\;
\If {$m_k(r_{new})m_j \subset m_k(r)m_j$} {
Q.enqueue($(k,j)$)\;
}
}
\For{k $\leftarrow$ 0 $\KwTo$ n} {
$m_i(r_{new})m_k$ $\leftarrow$ $m_i(r)m_k \cup (m_i(r_{new})m_j \circ m_j(r)m_k)$\;
\If {$m_i(r_{new})m_k \subset m_i(r)m_k$} {
Q.enqueue($(i,k)$)\;
}
}
}
\caption{Allen's Path Consistency}
\end{algorithm}
Which produces this result:
Basically, I want to disable the underlining of the conditions. Any suggestions?
Best Answer
Actually, you don't have to remove the
ulem
package, since it could be useful somewhere else. Use the\normalem
and\ULforem
commands provided by theulem
package.The conditions of
algorithm2e
package are emphasized, andulem
package by default replaces italics with underlining for all emphasized text, that's why underlines appear automatically when usingalgorithm2e
andulem
package together.But fortunately
ulem
package provides a\normalem
command/option to disable this default feature, and provides a\ULforem
command/option to enable it. So here is my solution:Reference:
ulem
manual http://texdoc.net/texmf-dist/doc/generic/ulem/ulem.pdfand this similar example: Getting \emph back to normal after loading ulem