2

I am trying to get vertical dotted/dashed lines in between of equation. I used \vdots and got this, but I want the dotted line to be bigger.

Following is what I've done.

 \begin{equation*}
    \begin{aligned}
         1|2|\dots|r \ \ \ \  r+1|r+2|\dots|k \vdots \ \ \ \ k+1|k+2|\dots|k+r
    \end{aligned}
\end{equation*}

This is what I've got as output. output

I want something like this with dotted or dashed lines (anything is fine) what I want

Any help is appreciated.

1
  • Welcome to TeX.SE.
    – Mico
    Jun 10 at 5:12

3 Answers 3

5

Take the definition of \vdots from fontmath.ltx and adapt it:

% from fontmath.ltx
\DeclareRobustCommand\vdots{%
  \vbox{%
    \baselineskip4\p@ \lineskiplimit\z@
    \kern6\p@
    \hbox{.}\hbox{.}\hbox{.}
  }%
}

You want more dots and that they are centered with respect to the formula axis, so the first step is to change \vbox into \vcenter. Now add as many dots you like (here nine) and make the symbol a math relation to go along with \mid.

\documentclass{article}
\usepackage{amsmath}  % for 'equation*' env.

\newcommand{\tallvdots}{%
  \vcenter{%
    \baselineskip=4pt \lineskiplimit=0pt
    \hbox{.}\hbox{.}\hbox{.}
    \hbox{.}\hbox{.}\hbox{.}
    \hbox{.}\hbox{.}\hbox{.}
  }%
}
\makeatother

\begin{document}

\begin{equation*}
1 \mid 2 \mid \dots \mid r 
\qquad  % or '\quad' if you prefer
r+1 \mid r+2 \mid \dots \mid k 
\mathrel{\tallvdots}
\qquad  % or '\quad' if you prefer
k+1 \mid k+2 \mid \dots \mid k+r
\end{equation*}

\end{document}

enter image description here

4

You can define \tallvdots by:

\def\tallvdots{%
   \mathrel{\vcenter{\offinterlineskip
      \kern-1.4ex\hbox{$\vdots$}\kern-.7ex\hbox{$\vdots$}%
   }}%
}

No array, no rotatebox. Only two \vdots one above second. The \kerns are here because the height of the default \vdots character has bad metric.

3

Something like this?

enter image description here

Note that in addition to creating and using a macro called \tallvdots, I've also replaced all instances of | with \mid.

\documentclass{article}
\usepackage{amsmath}  % for 'equation*' env.
\usepackage{graphicx} % for 'rotatebox' macro

% to be used in math mode:
\newcommand\xvdots{\vcenter{\hbox{$\vdots$}}}
\newcommand\tallvdots{% 
  \mathrel{\begin{array}{@{}c@{}} 
             \xvdots \\ \rotatebox{180}{$\xvdots$} 
           \end{array}
          }
  }

\begin{document}

\begin{equation*}
1 \mid 2 \mid \dots \mid r 
\qquad  % or '\quad' if you prefer
r+1 \mid r+2 \mid \dots \mid k 
\tallvdots 
\qquad  % or '\quad' if you prefer
k+1 \mid k+2 \mid \dots \mid k+r
\end{equation*}

\end{document}
2
  • 1
    Thank you. That's exactly what I want
    – Sergio
    Jun 10 at 5:16
  • 1
    @Sergio - Please go ahead and (a) unaccept the answer I posted and (b) accept @egreg's answer instead. His method is not only more elegant than mine, but it also solves a (somewhat hidden) problem with my method. (My method produces a solution whose total height and depth actually exceeds the visible height and depth.) Thanks.
    – Mico
    Jun 11 at 10:57

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.