8

I was writing an upper triangular matrix but due to large entry was unable to get in a good view.

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
   $$ J(\hat{\Phi})(p)=
   \begin{pmatrix*}[c]
   ((\hat{\Phi}(p)_{ij}))_{i,j=1}^r    &\hdots &   &  &\hdots   &                 ((\hat{\Phi}(p)_{ij}))_{i,j=1}^r                                  \\
  & \ddots      &     &    \vdots\\
         &      & \ddots    & &((\partial^{\alpha}\partial^{\beta}\hat{\Phi}(p)_{ij}))_{i,j=1}^r  &   \vdots        \\
 \text{\huge0} &  &   &       &     \\
 & & & & & ((\partial_d^{k-1}\hat{\Phi}(p)_{ij}))_{i,j=1}^r
\end{pmatrix*}
$$
\end{document}

enter image description here

4

If you are open to loading tikz, you could do

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\[ J(\widehat{\Phi})(p)=
   \begin{pmatrix*}[c]
   \tikzmarknode{tl}{((\widehat{\Phi}(p)_{ij}))_{i,j=1}^r}   & 
   \hspace*{9em}&
    \tikzmarknode{tr}{((\widehat{\Phi}(p)_{ij}))_{i,j=1}^r}    \\[4em]
 \tikzmarknode{bl}{~} &  &
 \tikzmarknode{br}{((\partial_d^{k-1}\widehat{\Phi}(p)_{ij}))_{i,j=1}^r}
\end{pmatrix*}
\begin{tikzpicture}[overlay,remember picture,Dotted/.style={%https://tex.stackexchange.com/a/101263/194703
 line width=#1, line cap=round, dash pattern=on 0pt off 4\pgflinewidth},
 Dotted/.default=1.5pt,shorten/.style={shorten >=#1/2,shorten <=#1/2}]
 \draw[Dotted,shorten=4ex]  (tl) -- (tr);
 \draw[Dotted,shorten=4ex]  (tr) -- (br);
 \draw[Dotted,shorten=5ex]  (tl) -- (br) node[pos=0.5,inner sep=0pt,above
 right]
  {$((\partial^{\alpha}\partial^{\beta}\widehat{\Phi}(p)_{ij}))_{i,j=1}^r$} ;
 \node[scale=3,above] at (bl.south west) {$0$};
\end{tikzpicture}
\]
\end{document}

enter image description here

You could also work with nicematrix (which uses TikZ).

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{nicematrix}
\begin{document}
\[ J(\widehat{\Phi})(p)=
   \begin{pNiceMatrix}[name=mymatrix]
   ((\widehat{\Phi}(p)_{ij}))_{i,j=1}^r   & 
   \Cdots \Hspace*{7em}& ((\widehat{\Phi}(p)_{ij}))_{i,j=1}^r\\[2em]
   &\Ddots & \Vdots \\[2em]
 ~ &  & 
  ((\partial_d^{k-1}\widehat{\Phi}(p)_{ij}))_{i,j=1}^r\\
\end{pNiceMatrix}
\begin{tikzpicture}[overlay,remember picture]
 \path (mymatrix-1-1) -- (mymatrix-3-3)
 node[pos=0.5,above right,inner sep=0pt]
   {$((\partial^{\alpha}\partial^{\beta}\widehat{\Phi}(p)_{ij}))_{i,j=1}^r$} ;
  \node[scale=3,above] at (mymatrix-3-1) {$0$};
\end{tikzpicture}
\]
\end{document}

enter image description here

  • I am getting errors with the code. Undefined control sequence. \tikzmarknode Package pgf Error: No shape named tl is known. \draw[Dotted,shorten=4ex] (tl) – XYZABC Sep 10 at 4:43
  • @XYZABC Then you have a rather old version of tikzmark on your computer. Are you using overleaf or can you update your installation? – Schrödinger's cat Sep 10 at 4:44
  • Just yesterday I installed texlive full in my Ubuntu. Let me try in overleaf. – XYZABC Sep 10 at 4:47
  • @XYZABC overleaf won't help. You could remove \usetikzlibrary{tikzmark} and add \newcommand{\tikzmarknode}[3][]{\begin{tikzpicture}[remember picture, baseline={(#2.base)}] \node(#2){\ensuremath{#3}}; \end{tikzpicture}}, this should work. I updated a few days ago and know that \tikzmarknode has been added a bit more than a year ago to the library. – Schrödinger's cat Sep 10 at 4:48
  • 1
    But the problem is that the middle entry is not on the diagonal. It is in the upper triangle in between. – XYZABC Sep 10 at 5:02
6

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}
  • 1
    I think this is not what the OP would like, they don't want the central element on the diagonal. – CarLaTeX Sep 10 at 5:27
  • 1
    @CarLaTeX: Ok, was not sure about that so have provided both versions now. – Peter Grill Sep 10 at 6:24
  • 1
    Thanks for this. I want the second one. – XYZABC Sep 10 at 6:33
3

Something like this?

enter image description here

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathtools,amssymb}
\begin{document}
\[
\setlength\arraycolsep{2.5pt} % default value: 5pt
J(\widehat{\Phi})(p)=
\begin{pmatrix}
\bigl((\widehat{\Phi}(p)^{}_{ij})\bigr)_{i,j=1}^r &\dots &\dots & \dots & 
       \bigl((\widehat{\Phi}(p)^{}_{ij})\bigr)_{i,j=1}^r \\
& \ddots & \vdots & & \vdots\\
& &\bigl((\partial^{\alpha}\partial^{\beta}\widehat{\Phi}(p)^{}_{ij})\bigr)_{i,j=1}^r & & \vdots \\
 & & & \ddots  & \vdots \\
 \hbox{\huge0} & & & & \bigl((\partial_d^{k-1}\widehat{\Phi}(p)^{}_{ij})\bigr)_{i,j=1}^r
\end{pmatrix}
\]
\end{document}
  • I think this is not what the OP would like, they don't want the central element on the diagonal – CarLaTeX Sep 10 at 5:27
  • 1
    @CarLaTeX - Indeed, one of the other answers does not place the "central element" on the main diagonal. However, below that answer, the OP has posted a comment that "the problem is that the middle entry is not on the diagonal" [emphasis added]. Let's see if the OP clarifies his/her formatting objectives. – Mico Sep 10 at 5:35
  • I think with "But the problem is that the middle entry is not on the diagonal. It is in the upper triangle in between." the OP intends the middle entry should not be on the diagonal, it should be in the upper triangle. See the picture of their question. – CarLaTeX Sep 10 at 5:42
  • @CarLaTeX - The OP's comment that you and I quote was posted before Schrödinger's cat posted an addendum to his (her?) initial answer. I honestly cannot detect much of a difference between the two screenshots, at least as far as the position of the "central element" is concerned. Let's see if the OP provides some much-needed clarification. – Mico Sep 10 at 5:54
  • 1

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.