\documentclass{article} \usepackage[pdftex,active,tightpage]{preview} \setlength\PreviewBorder{2mm} \usepackage[utf8]{inputenc} % this is needed for umlauts \usepackage[ngerman]{babel} % this is needed for umlauts \usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf \usepackage{amssymb,amsmath,amsfonts} % nice math rendering \usepackage{braket} % needed for \Set \usepackage{algorithm,algpseudocode} \usepackage{tikz} \usetikzlibrary{decorations.pathreplacing,calc} \newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};} \newcommand*{\AddNote}[4]{% \begin{tikzpicture}[overlay, remember picture] \draw [decoration={brace,amplitude=0.5em},decorate,very thick] ($(#3)!(#1.north)!($(#3)-(0,1)$)$) -- ($(#3)!(#2.south)!($(#3)-(0,1)$)$) node [align=center, text width=2.5cm, pos=0.5, anchor=west] {#4}; \end{tikzpicture} }% \begin{document} \begin{preview} \begin{algorithm}[H] \begin{algorithmic} \Require $R \in \mathbb{Z}^n, P \in (\mathbb{N}_{\geq 1})^n, n \in \mathbb{N}_{\geq 1}$, where \\ $R$ is a vector with all rests $r_i$ and\\ $P$ is a vector with all modulos $p_i$ such that\\ ($x \equiv r_i \mod p_i$) and $\left(i \neq j \Rightarrow \Call{gcd}{p_i, p_j} = 1 \right)$ \\ \State $M \gets \prod_{p \in P} p$ \For{$i \in \{1, \dots, n\}$} \State $M_i \gets \frac{M}{p_i} $ \State $y_i \gets \Call{getMultiplicativeInverse}{M_i, R_i}$ \EndFor \\ \State \Return $(\sum_{i=1}^n R_i y_i M_i, M)$ \end{algorithmic} \caption{Solve a system of linear congruences} \label{alg:solveCongruences} \end{algorithm} \end{preview} \end{document}