0

I'm unable to use the flags to center the column and add a dashed vertical line in the bmatrix environment. This code was working on another LaTeX file but somehow I can't make it work with beamer:

\documentclass[xcolor=dvipsnames, fleqn]{beamer}

\usepackage{arydshln} % for cdashline

\begin{document}

\begin{frame}
\begin{align*}
\begin{bmatrix}{c:cc}
 \phantom{+}1 & -1 & \phantom{+}1 \\ \cdashline{1-3}
 -1 & \phantom{+}1 & -1 \\ 
 \phantom{+}1 & -1 & 1 \\
\end{bmatrix}
\end{align*}
\end{frame}

\end{document}

By following a suggestion to show a MWE where it DOES work, I found the problem. In the preamble there's a new command that's created, but I don't understand what it's doing.

\documentclass[times]{nmeauth}
\usepackage{arydshln} % for cdashline

% choose the typewriter font used in algorithms
\makeatletter
  \renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
    \hskip -\arraycolsep
    \let\@ifnextchar\new@ifnextchar
  \array{#1}}
\makeatother

\begin{document}

{\renewcommand{\arraystretch}{2}
\begin{align*}
\newcommand*{\tmp}{\multicolumn{1}{r|}{}} 
\begin{bmatrix}[c:cc]
 \phantom{+}1 & -1 & \phantom{+}1 \\ \cdashline{1-3}
 -1 & \phantom{+}1 & -1 \\ 
 \phantom{+}1 & -1 & 1 \\
\end{bmatrix}
\end{align*}
}

\end{document}
  • Then please show us an example of a document where this works with bmatrix , which does not normally take any arguments as an environment. – daleif Apr 7 '16 at 17:05
1

arydshln doesn't mention bmatrix environment, so I've tested your code with array and it worked.

\documentclass[xcolor=dvipsnames, fleqn]{beamer}

\usepackage{arydshln} % for cdashline

\begin{document}

\begin{frame}
\begin{align*}
\left[\begin{array}{c:cc}
 \phantom{+}1 & -1 & \phantom{+}1 \\ \cdashline{1-3}
 -1 & \phantom{+}1 & -1 \\ 
 \phantom{+}1 & -1 & \phantom{+}1 \\
\end{array}\right]
\end{align*}
\end{frame}

\end{document}

enter image description here

  • I know it works with array, but I have a lot of equations with bmatrix that I have to copy from an article to a beamer presentation. – aaragon Apr 7 '16 at 17:01
  • 1
    @aaragon I've found this which combines arydshln with bmatrix but with some code which changes matrix syntax. – Ignasi Apr 7 '16 at 17:22
  • Yes, I found out the problem. Somehow I thought bmatrix supported this syntax by default. It's so convenient that I don't understand why it's not available as default. I still don't understand what the macro is doing though. – aaragon Apr 7 '16 at 17:33
  • @aaragon You can read what is doing in the answer to the linked question – Ignasi Apr 7 '16 at 17:42

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.