\State 1. Find all possible Euclidean distances between received symbols.\\
$d_{i} =\abs{r_i-r_j}  , \mkern30mu$
s.t. \mkern15mu j = i+1  ,\\
i \in\{1,…,(M-1)\}, \text{and} \\
j \in\{2,…,M\}
\State 2. Sort all $d_{i}=[d_{1},...,d_{M-1}]$ in ascending order. Assuming initialized ascending order as,\\
$[d_{M-1}$ <, ... ,< $d_{1}]$.
\caption{: Algorithm for best probability allocation order in 4-CSK-1PD} 
\For{$i$ \leq \mkern8mu $M$} {
    \If{$r_i\in \{d_{1}\} \mkern10mu only$ } 
        { $symbol \mkern15mu r_i \gets p_1$}
    \ElseIf {$r_i\in \{d_{1},d_{2}\} \mkern10mu$ }
        {$symbol\mkern15mu r_i\gets p_2$}
    \ElseIf {$r_i\in \{d_{M-1},d_{M-2}\} \mkern10mu$ }
        { $symbol \mkern15mu r_i\gets p_3$}
    \ElseIf {$r_i\in \{d_{M-1}\} \mkern10mu$ }
        { $symbol\mkern15mu r_i\gets p_4$}
    \Return{(Symbols with assigned probabilities)}

  • 2
    You should provide a minimal working example. Nov 1, 2019 at 21:54
  • Welcome to TeX.SE.
    – Mico
    Nov 1, 2019 at 23:14

1 Answer 1


In the line immediately below \end{algorithmic}, there's a syntax error in

\For{$i$ \leq \mkern8mu $M$} {

The directives \leq and \mkern must occur in math mode.

Hence, change the line to either

\For{$i \leq \mkern8mu M$} {

or, better still,

\For{$i \leq M \mkern8mu$} {

Separately, you should also change

$[d_{M-1}$ <, ... ,< $d_{1}]$


$[d_{M-1} < \dots < d_{1}]$

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.