# LaTeX Symbol Need

I am looking for the symbol used in many lectures to indicate "$k$ varies from 1 to $n$", which is the letter $n$ with a line under the letter and a line on the right of the letter. Hope the question is ok. Thanks

Just like this -->

• Off topic. First time I see this notation. – Sigur Dec 31 '19 at 11:41
• – Werner Dec 31 '19 at 17:33

You can "draw" that symbol using some graphics packages like TikZ. The below are three different options for you, each has its own advantages and disadvantages.

### Option 1

\documentclass{article}
\usepackage{tikz}
\newcommand\HappyNewYear[1]{\tikz[baseline=(x.base)]{
\node (x) {$#1$};
\draw (x.south west) -| (x.north east);
}}
\begin{document}
We have $k=\HappyNewYear{n}$. Test fraction: $k=\HappyNewYear{\frac{1}{2}}$
\end{document}


The spacing is not quite nice if it is put to a mathematical expression, though.

### Option 2

\documentclass{article}
\usepackage{lipsum}
\setlength\parindent{0pt}
\setlength\parskip{1em}
\usepackage{tikz}
\newcommand\HappyNewYear[1]{\hspace*{-.3333em}\tikz[baseline=(x.base)]{
\node (x) {$#1$};
\draw (x.south west) -| (x.north east);
}}
\begin{document}
$k=\HappyNewYear{n}$

\HappyNewYear{n} \lipsum[1]
\end{document}


However, it is also shifted if it is at the start of a line, which may not look good in some places in your document:

### Option 3

\documentclass{article}
\usepackage{lipsum}
\setlength\parindent{0pt}
\setlength\parskip{1em}
\usepackage{tikz}
\newcommand\HappyNewYear[1]{\tikz[baseline=(x.base)]{
\node[inner xsep=0pt] (x) {$#1$\hspace*{.3333em}};
\draw (x.south west) -| (x.north east);
}}
\begin{document}
$k=\HappyNewYear{n}$

\HappyNewYear{n} \lipsum[1]
\end{document}


The spacing is good, but it doesn't look centered in the box.

• Thank you very much, have a good day| – Francesco Dec 31 '19 at 9:50
• @Francesco Glad to help. If my answer helps you, please consider accepting it by clicking the tick. – Fractal is at topanswers.xyz Dec 31 '19 at 9:58
• When using k=... the space around = is not the same as k=n. – Sigur Dec 31 '19 at 11:46
• @Sigur That is the space caused by the left inner separation. It can be fixed, but the symbol will not look centered within the box. What is your suggestion on this? – Fractal is at topanswers.xyz Dec 31 '19 at 11:48
• @Sigur I just added two more options. – Fractal is at topanswers.xyz Dec 31 '19 at 12:32

\documentclass{article}
\usepackage{fancybox}
\begin{document}
$k = \varies n$
\end{document}

• Should n be in math mode? – Sigur Dec 31 '19 at 11:41
• @Sigur It can be used also in text mode. – Fran Dec 31 '19 at 13:35

Never seen such a notation.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\varies}[1]{%
\begin{array}[t]{@{}c@{\vline}}
\mspace{1mu}#1\mspace{2mu} \\
\hline
\end{array}
\mspace{1mu}
}

\begin{document}

for $k=\varies{n}$.

\end{document}