Similar to this question, I am trying to output a similar matrix with dotted line instead of dashed line.

enter image description here

  1. Is there anyway to do this?

  2. I also try to use these three packages:

  3. I also like to learn how to implement this in \documentclass{revtex4}, in addition to using in \documentclass{article}. As far as we know that arydshln may not be compatible with revtex4 or revtex4-1 as far as I tried.

I encounter a problem like this post. And I add arydshln after the tabularx; but it cannot compile successfully, but only output errors. Could someone offer any hints or some resolutions?

The answer needs not to be complete. Thank you for your help!!!

  • If there is no dotted lines but only dashed lines, then that is still fine as long as you can offer comments how the problem 2. can be resolved. – wonderich Apr 14 '14 at 23:26

Since revtex4 seems to be incompatible with the arydshln package, here's an option using TikZ:



  matrix of math nodes,
  column sep=1ex,
] (m)
B & C \\
D & E \\
  ([xshift=0.5ex]m-1-1.north east) -- ([xshift=0.5ex]m-2-1.south east);
  (m-1-1.south west) -- (m-1-2.south east);
\node[above,text depth=1pt] at (m-1-1.north) {$\scriptstyle r$};  
\node[above,text depth=1pt] at (m-1-2.north) {$\scriptstyle n-r$};
\node[left,overlay] at ([xshift=-1.2ex]m-1-1.west) {$\scriptstyle r$};
\node[left,overlay] at ([xshift=-1.2ex]m-2-1.west) {$\scriptstyle n-r$};


enter image description here

  • Gonzalo, +1, I am betting that your method works. Please let me try. – wonderich Apr 15 '14 at 1:19
  • i like this, but the vertical line seems a bit long both above and below (relative to the size of the parentheses), and the two expressions at the top have different baselines. ??? – barbara beeton Apr 15 '14 at 6:36
  • @barbarabeeton Thanks. I fixed the issues with the parentheses and the dotted lines and with the base lines. – Gonzalo Medina Apr 15 '14 at 14:01
  • @Idear I'd suggest you to edit your question and add there the information about the document class you are using (revtex4) so it becomes clear for everyone what the problem is with trying to use arydshln. – Gonzalo Medina Apr 15 '14 at 14:31

You can adjust the dash and gap of the \hdashline by modifying the lengths \dashlinedash and \dashlinegap:

enter image description here



  \leftidx{_{m-r}^{\phantom{m-r}\llap{$\scriptstyle r$}}}{\left( \begin{array}{c:c}
    \smash{\overset{r}{B}} & \mathclap{\smash{\overset{n-r}{C}}} \\
    D & E
  \end{array} \right)}{}

  ABC & DEF \\

The default for both of the lengths is 4pt.

  • Your answer is nice, I like it very much. I just find that the incompatibility is due to the documentclass, where mine case is \documentclass[aps,prl,twocolumn,nofootinbib,superscriptaddress,floatfix]{revtex4}; but yours is \documentclass{article}. Do you know why my \documentclass[aps,prl,twocolumn,nofootinbib,superscriptaddress,floatfix]{revtex4} is not compatible with the \usepackage{arydshln,leftidx,mathtools}? – wonderich Apr 15 '14 at 0:00
  • 3
    @Idear: This is why you should always post a minimal working example (MWE). Not sometimes, but always. Why use revtex4 and not revtex4-1? – Werner Apr 15 '14 at 0:09

This uses a stacking approach. This answer is helping me to think of ways to automate dotted/dashed lines as part of stacks, which in this MWE, had to be done very manually.

% From morsburg at http://tex.stackexchange.com/questions/12537/
% how-can-i-make-a-horizontal-dashed-line/12553#12553
\def\dashfill{\cleaders\hbox to .5em{\rule{.4ex}{.4pt}}\hfill}
\newcommand\dashline[1]{\hbox to #1{\dashfill\hfil}}

enter image description here

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.