Quantcast
Channel: Matrices upper triangular alignment - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 4

Answer by Peter Grill for Matrices upper triangular alignment

$
0
0

Here are two versions as I am not sure if you want the central element on or off the diagonal

enter image description here

enter image description here

where

  • I have used\mathrlap to hide the subscript and superscript from affecting column width so that the \ddots appear below them,
  • used \smash on the large zero so it does not effect vertical spacing,
  • used \multicolumn{}{}{} for the case on central element being off the diagonal, and
  • eliminated unneeded packages for this example.

Code:

\documentclass{article}\usepackage{mathtools}\newcommand*{\A}{((\hat{\Phi}(p)_{ij}))\mathrlap{{}_{i,j=1}^r}}%\newcommand*{\B}{((\partial^{\alpha}\partial^{\beta}\hat{\Phi}(p)_{ij}))\mathrlap{{}_{i,j=1}^r}}%\newcommand*{\C}{((\partial_d^{k-1}\hat{\Phi}(p)_{ij}))_{i,j=1}^r}\newcommand*{\BigZ}{\hspace*{2.0em}\smash{\text{\Huge0}}}\begin{document}\[    J(\hat{\Phi})(p)=   \begin{pmatrix*}[c]     \A  &        & \hdots  &  \hdots & \A     \\& \ddots &         &         & \vdots \\&        & \B      &         & \vdots \\   \BigZ &        &         & \ddots  & \vdots \\&        &         &         & \C     \\\end{pmatrix*}\]\end{document}

Code: Central Element off Diagonal

\documentclass{article}\usepackage{mathtools}\newcommand*{\A}{((\hat{\Phi}(p)_{ij})){{}_{i,j=1}^r}}%\newcommand*{\B}{((\partial^{\alpha}\partial^{\beta}\hat{\Phi}\mathrlap{(p)_{ij})){}_{i,j=1}^r}}%\newcommand*{\C}{((\partial_d^{k-1}\hat{\Phi}(p)_{ij}))_{i,j=1}^r}\newcommand*{\BigZ}{\hspace*{2.0em}\smash{\text{\Huge0}}}\begin{document}\[    J(\hat{\Phi})(p)=   \begin{pmatrix*}[c]     \A  & \hdots & \hdots  &  \hdots   &  \hdots    & \A     \\& \ddots &         &           &            & \vdots \\&        & \ddots  & \multicolumn{2}{c}{\B} & \vdots \\   \BigZ &        &         & \ddots    &            & \vdots \\&        &         &           & \ddots     & \vdots \\&        &         &           &            & \C     \\\end{pmatrix*}\]\end{document}

Viewing all articles
Browse latest Browse all 4

Trending Articles