Math & Science ⇒ How to type complexity equation in overleaf
-
- Posts: 1
- Joined: Tue Jun 27, 2023 4:18 am
How to type complexity equation in overleaf
Thank you all,
- Attachments
-
- Capture.PNG (30.47 KiB) Viewed 18524 times
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
How to type complexity equation in overleaf
You need use
nicematrix
package. It definitelly can do such matrices.https://ctan.org/pkg/nicematrix
Unfortunatelly, I'm not LaTeX professional, so this is the best I can do, sorry.
Code: Select all
\documentclass{article}\usepackage{tikz}\usepackage{nicematrix}\begin{document}$$\begin{pNiceArray}{ccccccccc}[first-row,first-col]& n + 1 & \cdots & n + m & 1 & \cdots & m & m +1 & \cdots & n \\{n + 1}& \Block[borders={bottom, right, tikz={dashed}}]{3-3}{\vec a} & & &\Block[borders={bottom, right, tikz={dashed}}]{3-3}{\vec b} & & &\Block[borders={bottom, tikz={dashed}}]{3-3}{\vec c} & & \\{\Vdots} & & & & & & & & & \\{n + m} & & & & & & & & & \\{1} & \Block[borders={bottom, right, tikz={dashed}}]{3-3}{\vec x} & & & \Block{6-6}{\vec a} & & & & & \\{\Vdots} & & & & & & & & & \\{m} & & & & & & & & & \\{m + 1} & \Block[borders={right, tikz={dashed}}]{3-3}{\vec y} & & & & & & & & \\{\Vdots} & & & & & & & & & \\{n} & & & & & & & & & \\\end{pNiceArray}$$\end{document}

The main problem of my solution is that left exterior column is right aligned. According nicematrix documentation this is by design (page 24 on pdf documentation). In footnote 35 on this page I read that we need to use
\CodeAfter
and \Submatrix
to make left exterior column be centering or to have other alignment. I tried this without success. The error is about the last column is empty, and I have no idea how to solve this. Of course there is an email of package author on the top of nicematrix documentation...AGSH
How to type complexity equation in overleaf
nicematrix
and the first column left-aligned (by using the command \SubMatrix
in the so-called \CodeAfter
.Code: Select all
\documentclass{article}\usepackage{tikz}\usepackage{nicematrix}\begin{document}\[\begin{NiceArray}{lccccccccc}[first-row]& n + 1 & \cdots & n + m & 1 & \cdots & m & m +1 & \cdots & n \\n + 1& \Block[borders={bottom, right, tikz=dashed}]{3-3}{\vec{a}} & & &\Block[borders={bottom, right, tikz=dashed}]{3-3}{\vec{b}} & & &\Block[borders={bottom, tikz=dashed}]{3-3}{\vec{c}} & & \\\vdots & & & & & & & & & \\n + m & & & & & & & & & \\1 & \Block[borders={bottom, right, tikz=dashed}]{3-3}{\vec{x}} & & & \Block{6-6}{\vec{a}} & & & & & \\\vdots & & & & & & & & & \\m & & & & & & & & & \\m + 1 & \Block[borders={right, tikz=dashed}]{3-3}{\vec{y}} & & & & & & & & \\\vdots & & & & & & & & & \\n & & & & & & & & & \\\CodeAfter\SubMatrix({1-2}{9-10})\end{NiceArray}\]\end{document}