5

How to draw these two lines?

\documentclass[twocolumn]{ltxdoc}
\usepackage{amsmath}
\usepackage{lipsum}

\begin{document} \begin{equation} Trans_{z_{n-1}}(d_n) = \begin{bmatrix}

1 & 0 & 0 & 0 \\

0 & 1 & 0 & 0\ 0 & 0 & 1 & d_{n}\ 0 & 0 & 0 & 1

\end{bmatrix}

\end{equation} \end{document}

enter image description here

My current version is like this:

enter image description here

James
  • 415
  • 1
    Off topic comments: (1) ltxdoc is designed for typesetting tex documentation, not math articles; I would switch to just article. (2) Equation environments aren't allowed to have blank lines. (3) Trans is the product of 5 separate variables; \mathrm{Trans} would be better. – Teepeemm Jan 26 '23 at 14:50
  • See also https://tex.stackexchange.com/questions/79134/a-matrix-with-labels-dashed-lines?r=SearchResults&s=2%7C61.0505 and https://tex.stackexchange.com/questions/581086/latex-how-to-add-dashed-lines-for-matrix?r=SearchResults&s=4%7C60.2237 – John Kormylo Jan 26 '23 at 17:30

3 Answers3

7

You could use the tabularray package like this:

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{amsmath}

\begin{document} \begin{equation} \text{Trans}{z{n-1}}(d_n) = \begin{+bmatrix}[ hline{Y} = {solid}, vline{Y} = {solid} ] 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0\ 0 & 0 & 1 & d_{n}\ 0 & 0 & 0 & 1 \end{+bmatrix} \end{equation} \end{document}

enter image description here

6

With nicematrix:

\documentclass{article}
\usepackage{nicematrix}

\begin{document} [ \mathrm{Trans}{z{n-1}}(d_n) = \begin{bNiceArray}{ccc|c}[margin] 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0\ 0 & 0 & 1 & d_{n}\ \hline 0 & 0 & 0 & 1 \ \end{bNiceArray} ] \end{document}

enter image description here

Andrey L.
  • 1,794
3
\documentclass[twocolumn]{ltxdoc}
\usepackage{amsmath}
\usepackage{lipsum}

\begin{document}
\begin{equation}
    Trans_{z_{n-1}}(d_n) = \left[\begin{array}{ccc@{\enskip\vrule\enskip}c}
    1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0\\
0 & 0 & 1 & d_{n}\\
\hline
0 & 0 & 0 & 1
    \end{array}\right]
\end{equation}

\end{document}

enter image description here

MadyYuvi
  • 13,693