I want to write a matrix with equal column widths, plus have a vertical line down the matrix. By using the solutions given here and here, I have
\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{graphicx}
% draw vertical line down matrix
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{#1}}
\makeatother
\begin{document}
\resizebox{\linewidth}{!}{%
\begin{equation}
\begin{pmatrix}[cc|cc]
C1 & Column2 & C3 & C4 \\ \hline
C5 & C6 & C7 & Column8
\end{pmatrix}$%
\end{equation}
}
\end{document}
The output matrix does not have equal column widths, and I get an error Missing $ inserted. How can I solve this problem?



\resizeboxaround theequationenvironment doesn't. You could box that up, but this would most likely destroy the effects of\resizebox– Skillmon Aug 31 '17 at 08:26\resizebox? – egreg Aug 31 '17 at 08:45