algorithm2e: Kommentare bündig ausrichten
Verfasst: Fr 20. Okt 2017, 11:39
Hallo zusammen. Wie schaffe ich es, dass Kommentare in der algorithm2e-Umgebung, rechtsbündig ausgerichtet werden? Ich habe es mit und probiert. Mit entstehen unschöne vertikale Zwischenräume (siehe unten).
Der Code:
[/code]
\tcp*[f]
\tcp*[h]
\tcp*[l]
Der Code:
\documentclass{article} \usepackage{listings} \usepackage[]{algorithm2e} \usepackage{colortbl} \begin{document} \RestyleAlgo{boxruled} %\IncMargin{2em} \DontPrintSemicolon \begin{algorithm}[H] \lstset{language=C} \color{red}{\nl}\color{black} foo \tcp*[l]{hash = 0}\; \color{red}{\nl}\color{black} foo bar foo bar r2, 0x26c \tcp*[l] {foo comment}\; \color{red}{\nl}\color{black} bar \tcp*[l]{bar}\; \color{red}{\nl}\color{black} loop:\; \color{red}{\nl}\color{black} foo bar foo bar foo bar \tcp*[l] {foo bar foo bar comment}\; \caption{foo bar.} \end{algorithm} \end{document}