4

It seems to me that my method is quite inconvenient. Could someone help me in this matter?

    \documentclass[11pt,a4paper]{article}
    \usepackage{blindtext}
    \usepackage{mathtools}
    \DeclareMathOperator{\sgn}{sgn}
\begin{document}
    $\begin{vmatrix}
    a_{11} \cdots a_{1r}\cdots a_{1n}\\
    \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \dots \cdot \cdot \cdots \cdot \\
    a_{n1} \cdots a_{nr} \cdots a_{nn}
\end{vmatrix}$
\end{document}

1 Answers1

5

With amsmath you have \hdotsfor:

\documentclass[11pt,a4paper]{article}
\usepackage{mathtools}

\begin{document}
$\begin{vmatrix}
  a_{11} & \dots & a_{1r} & \dots & a_{1n}\\
  \hdotsfor{5} \\
  a_{n1} & \dots & a_{nr} & \dots & a_{nn}
\end{vmatrix}$

$\begingroup\addtolength{\arraycolsep}{-3pt}\begin{vmatrix}
  a_{11} & \dots & a_{1r} & \dots & a_{1n}\\
  \hdotsfor{5} \\
  a_{n1} & \dots & a_{nr} & \dots & a_{nn}
\end{vmatrix}\endgroup$
\end{document}

In the second example I reduced the default intercolumn space.

enter image description here

If you prefer centered dots, here's a \hcdotsfor command (the same as \hdotsfor, except that \cdot is used).

\documentclass[11pt,a4paper]{article}
\usepackage{mathtools}

\makeatletter
\newcommand{\hcdotsfor}[1]{%
  \ifx[#1\@xp\shcdots@for\else\hcdots@for\@ne{#1}\fi}
\def\shcdots@for#1]{\hcdots@for{#1}}
\def\hcdots@for#1#2{\multicolumn{#2}c%
  {\m@th\dotsspace@1.5mu\mkern-#1\dotsspace@
   \xleaders\hbox{$\m@th\mkern#1\dotsspace@\cdot\mkern#1\dotsspace@$}%
           \hfill
   \mkern-#1\dotsspace@}%
   }
\makeatother

\begin{document}
$\begin{vmatrix}
  a_{11} & \cdots & a_{1r} & \cdots & a_{1n}\\
  \hcdotsfor{5} \\
  a_{n1} & \cdots & a_{nr} & \cdots & a_{nn}
\end{vmatrix}$

$\begingroup\addtolength{\arraycolsep}{-3pt}\begin{vmatrix}
  a_{11} & \cdots & a_{1r} & \cdots & a_{1n}\\
  \hcdotsfor{5} \\
  a_{n1} & \cdots & a_{nr} & \cdots & a_{nn}
\end{vmatrix}\endgroup$
\end{document}

enter image description here

egreg
  • 1,121,712
  • This is the answer I honestly wanted. I did not know about \hdotsfor{n} LaTex command. Thank you so very much! I really appreciate your favour. – Nisal Kevin Kotinkaduwa Sep 11 '14 at 15:02
  • 2
    @NisalKevinKotinkaduwa It's a command provided by amsmath (which is automatically loaded by mathtools). – egreg Sep 11 '14 at 15:04