0

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 --> enter image description here

2

3 Answers 3

5

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.

enter image description here


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:

enter image description here


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.

enter image description here

5
  • 1
    Thank you very much, have a good day|
    – Francesco
    Commented Dec 31, 2019 at 9:50
  • 1
    @Francesco Glad to help. If my answer helps you, please consider accepting it by clicking the tick.
    – fractal
    Commented Dec 31, 2019 at 9:58
  • When using k=... the space around = is not the same as k=n.
    – Sigur
    Commented Dec 31, 2019 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
    Commented Dec 31, 2019 at 11:48
  • @Sigur I just added two more options.
    – fractal
    Commented Dec 31, 2019 at 12:32
2

mwe

\documentclass{article}
\usepackage{fancybox}
\def\varies#1{\raisebox{-.5ex}{{\shadowsize.4pt\fboxrule0pt\fboxsep.5ex\shadowbox{{#1}}}}} 
\begin{document}
\[ k = \varies n \]
\end{document}
2
  • Should n be in math mode?
    – Sigur
    Commented Dec 31, 2019 at 11:41
  • @Sigur It can be used also in text mode.
    – Fran
    Commented Dec 31, 2019 at 13:35
2

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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .