TeX - LaTeX Asked on December 29, 2021
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{amsmath}
usepackage{amsfonts}
usepackage{amssymb}
usepackage{makeidx}
usepackage{graphicx}
begin{document}
[
P=left[
begin{array}{cccc|cccccccccccc}
1 & 1 & dots &1 & 1 & 1& dots & 1 \
1 & & & & & & \
vdots & & textbf{Huge{C}} & &&& textbf{Huge{0}} & \
1 & & & & & & \
cline{2-8}
1 & & & & & & \
cdots & & textbf{Huge{0}} & & &&textbf{Huge{D}} \
1 & & & & & &
end{array}
right]
]
end{document}
I have written the following code. The problem I am facing is I want the line to appear after the first row.
Please find the picture attached of the matrix I want to have.
How do I remove the line from the first row?
Please help
I would be happy and grateful if it be done by just doing some manipulations to my given code.
I want to do it without using any packages
By adapting the code of the OP:
documentclass{article}
usepackage{amsmath}
usepackage{amsfonts}
usepackage{amssymb}
begin{document}
begin{center}
[
P=
left[
begin{matrix}
1 & 1 & dots & 1 & 1 & 1 & dots & 1 \
1 & & & & multicolumn{1}{c|}{} & & \
vdots & & textbf{Huge{C}} & & multicolumn{1}{c|}{} & & textbf{Huge{0}} & \
1 & & & & multicolumn{1}{c|}{} & & \
cline{2-8}
1 & & & & multicolumn{1}{c|}{} & & \
vdots & & textbf{Huge{0}} & & multicolumn{1}{c|}{} & &textbf{Huge{D}} \
1 & & & & multicolumn{1}{c|}{} & &
end{matrix} ;
right]
]
end{center}
end{document}
Answered by F. Pantigny on December 29, 2021
Like this? I use nicematrix
package to redraw the matrix, the key point is first-row
option.
documentclass{article}
usepackage{nicematrix}
usepackage{amsmath}
usepackage{amsfonts}
usepackage{amssymb}
begin{document}
[
p=left[
begin{NiceArray}{*4{C}|*3{C}}[first-row, extra-margin=2mm]
1 & 1 & Cdots & 1 & 1 & Cdots & 1 \
1 & Block{3-3}<Huge>{mathbf{C}} & & & Block{3-3}<Huge>{mathbf{0}} & & \
Vdots & & & & & & \
1 & & & & & & \
cline{2-7}
1 & Block{3-3}<Huge>{mathbf{0}} & & & Block{3-3}<Huge>{mathbf{D}} & & \
Vdots & & & & & & \
1 & & & & & & \
end{NiceArray}right]
]
end{document}
Answered by ZhiyuanLck on December 29, 2021
With array
and some nesting:
documentclass{article}
usepackage{amsmath,array}
newcommand{bigentry}[2][huge]{begin{tabular}{@{}c@{}}#1$#2$end{tabular}}
begin{document}
[
newcommand{ones}{begin{matrix} 1 \[-1ex] vdots \ 1 end{matrix}}
left[begin{array}{ c @{} c | c @{} }
noalign{vspace{0.5ex}}
begin{matrix} 1 end{matrix} &
multicolumn{1}{c@{}}{begin{matrix} 1 & dots & 1 end{matrix}} &
begin{matrix} 1 & dots & 1 end{matrix} \
ones & bigentry{mathbf{C}} & bigentry{mathbf{0}} \
cline{2-3}
ones & bigentry{mathbf{0}} & bigentry{mathbf{D}} \
noalign{vspace{0.5ex}}
end{array}right]
]
end{document}
We need a couple of tricks because of vdots
not being really suitable for the purpose, so some vertical space has to be added at the top and the bottom.
Avoid textbf
for math objects in formulas, it should be mathbf
.
The nested tabular
for bigentry
ensures vertical centering and can accommodate a size changing command, which would otherwise be illegal in math mode.
The command ones
is just a local shorthand for reducing code clutter.
Answered by egreg on December 29, 2021
A proposition with nicematrix
:
documentclass{article}
usepackage{nicematrix}
usepackage{tikz}
begin{document}
$begin{pNiceArray}{ccccr}[columns-width=4mm,right-margin,nullify-dots]
1 & Cdots & & & 1 \
Vdots & Block{2-2}<Large>{C} & & Block{2-2}<Large>{0} & \
\
& Block{2-2}<Large>{0} & & Block{2-2}<Large>{D} & \
1
CodeAfter
tikz draw (4-|2) -- (4-|6) (2-|4) -- (6-|4) ;
end{pNiceArray}$
end{document}
Answered by F. Pantigny on December 29, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP