This is difficult for me with all these $ signs. Now, where is the problem in the following MWE?
\documentclass{article}%
\usepackage{amsmath}%
\usepackage{amsfonts}%
\usepackage{amssymb}%
\usepackage{graphicx}
\usepackage{comment}
\begin{document}
\varphi_{nk}(x,y) = \left\{
\begin{array}{c l}
1 & $x_{k}\succ_{n} y_{k}$\\
1/2 & $x_{k} \sim_{n} y_{k}$\\
0 & $x_{k}\prec_{n} y_{k}$
\end{array}
\right.
So \textit{n} is \varphi_{n}(x,y)= \sum_{k}\varphi_{nk}
\end{document}
Also a more general question related to Tex.sx. How can I copy the code to the question box, without having to press space bar 4 times for each line to indent it?
As a follow up, in case I would like to insert the word 'if' in every case (piece) of the function above, how can I do so? Eg
...1/2 & if $x_{k}\succ_{n} y_{k}$
doesn't seem to work as the 'if' is conjoined.