4

I need to create a code for the following matrix:

enter image description here

Can you help me to do that?

2
  • 2
    Well, what have you tried so far? Please show us the code ...
    – Mensch
    Commented Sep 23, 2016 at 21:46
  • 1
    Could you disclose where you took the posted picture from?
    – GuM
    Commented Sep 24, 2016 at 0:11

3 Answers 3

11

This seems to quite faithfully reproduce the image (apart from the dots that are centered, but I prefer them low, in this case). I also have improved the output by adding \, after the square roots.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
\renewcommand{\arraystretch}{1.5} % give some more room
d\varphi_{t}^{\vec{v}}=
\left(\begin{array}{@{}c|c@{}}
  h_{ij}+ta_{ij} &
  \begin{matrix}
  \sqrt{1+t^2}\,h_{n+1\,1} \\
  \vdots \\
  \sqrt{1+t^2}\,h_{n+1\,n}
  \end{matrix}
\\ \hline
  \begin{matrix}
  h_{n+1\,1}+tv_{1} & \dots & h_{n+1\,n}+tv_{n}
  \end{matrix}
  & \sqrt{1+t^2}\,h_{n+1\,n+1}
\end{array}\right)
\]

\end{document}

enter image description here

2
  • Why was \arraystrech{1.5} used? Commented Sep 23, 2016 at 21:50
  • 1
    @EduardoLonga It widens the distances between rows. The cases environment does the same.
    – egreg
    Commented Sep 23, 2016 at 21:56
8

A slightly simplified egreg nice solution (without nested matrix):

\documentclass[border=3mm,varwidth]{standalone}

\begin{document}
\[\renewcommand{\arraystretch}{1.5}
\mathrm{d}\phi_t^{\vec{v}}
    = \left(\begin{array}{c|c}
                    &   \sqrt{1+t^2} h_{n+1\;1}  \\
h_{ij} + t_{a_{ij}} &   \vdots                   \\
                    &   \sqrt{1+t^2} h_{n+1\;n}  \\
\hline
h_{n\;11}+ tv_1 \quad\dots\quad h_{n+1\;n}+ tv_n  
                    &   \sqrt{1+t^2} h_{n+1\;n+1}
            \end{array}\right)
\]
\end{document}

enter image description here

Edit: I increase (horizontal) space around dots that it is more evident that in this row as well as in rows above are $n$ matix cells. This improved matrix layout was inspired by Gustavo Mezzetti comments.

Regardin oprator d: many people write it on the same way as variables (in italic shape), but also there are many of us, which dor differenciate consider upright shape, which is used for other operators like \sin, \cos etc.

To easier distinguish squere roots from other part of math expresion several people insert small space betwee, others use symbol as we learn in elementary school:

enter image description here

For this solution in preqamble of above MWE is added:

\usepackage{letltxmacro}
\makeatletter
    \let\oldr@@t\r@@t
    \def\r@@t#1#2{%
    \setbox0=\hbox{$\oldr@@t#1{#2\,}$}\dimen0=\ht0
    \advance\dimen0-0.2\ht0
    \setbox2=\hbox{\vrule height\ht0 depth -\dimen0}%
    {\box0\lower0.4pt\box2}}
    \LetLtxMacro{\oldsqrt}{\sqrt}
    \renewcommand*{\sqrt}[2][\ ]{\oldsqrt[#1]{#2}}
\makeatother
5
  • Mmhhh… The last line doesn’t look right to me. (I won’t even touch on the dispute concerning \mathrm{d}… ;-)
    – GuM
    Commented Sep 23, 2016 at 23:50
  • and what is wrong with last line? only difference is that instead of t i mistype q ... (now corrected) this should not be the problem to change (anyway, OP didn't provide anything from code). if OP don't like correct typing of operators, he can omit \mathrm and type d\phi_t^{\vec{v}}.
    – Zarko
    Commented Sep 24, 2016 at 0:02
  • I didn’t even notice the q, but IMHO there should be some space around the dots. In other words, I think that @egreg’s idea of using submatrices should not be dropped. I repeat, this is just my humble opinion. (And please, do not take the \mathrm{d} thing personally… ;-)
    – GuM
    Commented Sep 24, 2016 at 0:09
  • @GustavoMezzetti, apparently I was blind :-( Till to now I didn't notice problem with space around \dots. Thank to your comments I increase it now (see edited answer). And indeed, the looks of matrix is now better. Thank you very much.
    – Zarko
    Commented Sep 24, 2016 at 7:34
  • Now I can upvote your answer too… :-)
    – GuM
    Commented Sep 24, 2016 at 11:37
3

With {pNiceArray} of nicematrix.

\documentclass[border=3mm,varwidth]{standalone}
\usepackage{nicematrix}

\begin{document}
\[\renewcommand{\arraystretch}{1.5}
\mathrm{d} \phi_t^{\vec{v}} = 
\begin{pNiceArray}{ccc|c}[margin=1pt]
\Block{3-3}{h_{ij} + t_{a_{ij}}} &&&   \sqrt{1+t^2} h_{n+1\;1}  \\
                               &&&   \vdots \\
                               &&&   \sqrt{1+t^2} h_{n+1\;n}  \\
\hline
h_{n\;11}+ tv_1 & \dots & h_{n+1\;n}+ tv_n & \sqrt{1+t^2} h_{n+1\;n+1}
\end{pNiceArray}
\]

\end{document}

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .