New answers tagged

3

With package easybmat you can add paths to your matrix. \documentclass{article} \usepackage{easybmat} \begin{document} \[P= \left[ \begin{BMAT}{ccccccc|c}{cccccc|c} 0 & 0 & 1 & 0 & 0 & 0 & 0& 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0& 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0& 0 \\ 0 & 0 &...


3

Here is two ways of doing that with {bNiceMatrix} of nicematrix. For the first method, I have drawn all the rules with Tikz using the PGF/Tikz nodes created by nicematrix (you need at least the version 5.11 2021-02-22). For the second method, I have created blocks (with the built-in command \Block) and the key hvlines-except-blocks draws all the rules ...


1

Off the top of my head, you could do something like: \newcommand{\xx}{\multicolumn{1}{c}} \[ \left[ \begin{array}{c|c|c|c|c|c|c} & & & & & & \\ \cline{1-2} & & & & & & \\ \cline{1-3} \xx{}& & & & & & \\ \cline{1-4} \xx{}&\xx{}& & & & &\\ \...


1

\documentclass{article} \usepackage{amsmath} \usepackage{nicefrac} \begin{document} \begin{equation}\label{eqn:13} \sigma(t_{c}) = \begin{cases} 1 & \\ [0,1] & \text{ if } t_c \\ 0 & \\ \end{cases}% \begin{cases} < \\ = \nicefrac{-\alpha N(m_{c},m_{e})}{...


1

Here is a solution with {NiceTabular} of nicematrix. \documentclass{article} \usepackage{nicematrix} \begin{document} \begin{NiceTabular}{c@{\;}cccc} & & \Block{1-3}{Current State} \\ & & L & M & C \\ \Block{3-1}{\rotate Next State} & L & .94 & .02 & .01 \\ & M & .05 & .96 & .04 \\ &...


1

You could to use also spalign package which provides a facility for typesetting matrices, and using other alignment environments and macros, with spaces as the alignment delimiter and semicolons (by default) as the end-of-row indicator (see the documentation). I have used \spalignmat[r] (with the option r (right)). Very important are the blank spaces. \...


4

There are so many solutions already, but I like add some more, which I used for my currently unpublished book. It's a bit tricky, but with rather simple code and easy to read and understand, I hope you like it :-) \documentclass[border=5pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[x=0.5cm, y=0.5cm] \foreach \z [count=\zx] in {Z,......


6

Just for fun, another solution based on \foreach macro from OpTeX: \def\list{ABCDEFGHIJKLMNOPQRSTUVWXYZ} \def\cyclelist#1#2\relax{\def\list{#2#1}} \def\fr#1{\hbox to1.3em{\hss#1\hss\vrule height10pt depth4pt}} \vbox{ \hbox{\ea\foreach\list \do{\hbox to1.3em{\hss\bf #1\hss}}} \smallskip\hrule \ea\foreach\list \do{% \hbox{\llap{\bf#1 }\vrule\ea\...


6

Just for fun, a ConTeXt solution: %%% Funny colors \usecolors[svg] %%% For a smaller image \setupbodyfont[small] \starttext %%% ConTeXt counterpart of standalone \startTEXpage[offset=1pt] %%% The actual fun \startluacode local uwu = { background = "color", backgroundcolor = "darkkhaki", style="\\ssbf" } context....


8

Another way of cycling through the alphabet using pgffor: \documentclass{article} \usepackage[margin=1in]{geometry} \usepackage{pgffor,xcolor,eqparbox} \makeatletter \newcommand{\ALPH}[1]{% \ifnum #1>26 \@Alph{\numexpr#1-26}% \else \@Alph{#1}% \fi } \makeatother \begin{document} \begingroup \makeatletter \sffamily\footnotesize \...


10

Here's a LuaLaTeX-based solution. \documentclass{article} \usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably \usepackage{array} % for '\extrarowheight' macro \usepackage[table]{xcolor} \usepackage{luacode} \begin{luacode} s="ABCDEFGHIJKLMNOPQRSTUVWXYZ" -- an auxiliary function function rowprint ( t ) for i = 1,26 ...


12

Fill the table one row at a time. \documentclass{article} \usepackage[table]{xcolor} \definecolor{headers}{RGB}{234,232,218} \ExplSyntaxOn \tl_new:N \l_vigenere_body_tl \NewDocumentCommand{\vigenere}{} { % make the first row \tl_set:Nn \l_vigenere_body_tl { \hline \rowcolor{headers} } \tl_put_right:Nx \l_vigenere_body_tl { \...


1

Here is a solution with nicematrix (last version: 5.10 of 2021/02/05). I have replaced the last {bmatrix} by a {bNiceMatrix}. Then, I have put a brace with the command \SubMatrix available in the \CodeAfter of the {bNiceMatrix}. Then, I have put the label with Tikz on the right of the Tikz node created by nicematrix for the brace. \documentclass{article} \...


1

Here is a solution with {NiceArray} of nicematrix. \documentclass{article} \usepackage{nicematrix} \begin{document} $\begin{NiceArray}{cc!{\;}cc} & & 1 & 3\\ & & 2 & -5 \\ \noalign{\vspace{1ex}} 11 & 22 & 33 & x^2+ 1 \\ 25121 & 2 & 3 & -5 \\ \CodeAfter \SubMatrix({1-3}{2-4}) \SubMatrix({3-1}{4-2}) \...


0

Here is another way to do that with nicematrix. In the latest version (5.10 of 2021-02-05), there is a built-in command \SubMatrix which I used to add the brackets in the array previously constructed. \documentclass{article} \usepackage{nicematrix} \begin{document} $A = \enskip \begin{NiceMatrix}[baseline=4] \Block{1-3}{\text{Top Title}} \\ 1 & 2 & ...


1

With the latest version of nicematrix (v. 5.10 of 2021-02-05), you can construct an array and add the brackets after with the built-in command \SubMatrix. You don't need \vphantom. \documentclass{article} \usepackage{nicematrix} \newcommand{\dpartial}[2]{\frac{\partial #1}{\partial #2}} \begin{document} \begin{equation} \everymath{\displaystyle} \begin{...


1

Welcome to TEX.SE! It's a nice approach. I use nicematrix package to do this. \documentclass{article} \usepackage{amsmath} \usepackage{nicematrix} \begin{document} \begin{align*} \begin{array}{cc} \text{Top Title} & \\ \begin{bNiceMatrix}[first-row,last-col] 1 & 2 & 3 & \\ ...


1

In order to label a simple 3x3 matrix, you can either do it by columns/rows or give it a full title over the whole matrix. This is the code for both the full titles and by each column/row: \begin{document} \begingroup \setlength{\tabcolsep}{2pt} % sets spacing horizontally \renewcommand{\arraystretch}{1} % sets spacing vertically \begin{tabular}{ c c c } %=...


0

The lastest version of nicematrix (v. 5.10 of 2021-02-05) provides an easy way to obtain the required output. \documentclass{standalone} \usepackage{nicematrix} \begin{document} $\begin{NiceMatrix} & C_1 & C_2 & C_3 & C_4 & \\ L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\ L_2 & a_{21} & a_{22} & a_{23} &...


2

With {pNiceArray} of nicematrix. \documentclass{article} \usepackage{nicematrix,tikz} \begin{document} \[\mathbf{R}= \begin{pNiceArray}{cccc}[first-col,first-row] & \lambda_1 & \lambda_2 & \lambda_3 & \lambda_4 \\ \hline \noalign{\vskip2pt} \tau_1 & -1 & \phantom{-}1 & \phantom{-}0 & \phantom{-}0 \\ \...


3

Insert a space within the column specification of your blockarray: \documentclass{article} \usepackage{booktabs} \usepackage{blkarray} \begin{document} \[ \mathbf{R} = \begin{blockarray}{ cccccc } & \lambda_1 & \lambda_2 & \lambda_3 & \lambda_4 \\ \cmidrule{2-6} \begin{block}{@{} c @{\hspace{1ex}} | @{\quad} (ccccc) } ...


2

With nicematrix and Tikz. \documentclass{article} \usepackage{amssymb} \usepackage{nicematrix} \usepackage{tikz} \begin{document} \begingroup \setlength{\arraycolsep}{8pt} \setlength{\extrarowheight}{4mm} $\begin{NiceMatrix}[xdots/shorten=6pt] |\alpha|+|\beta|=0 & \Cdots & \lambda_{1,0} & \lambda_{2,0} ...


3

An easy way to do it could be using tikz matrix library. That an a couple of lines and you have it. \documentclass {standalone} \usepackage {amssymb} \usepackage {tikz} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture}[line cap=round,line join=round] \def\sep{0.3cm} \matrix(D)[matrix of nodes,minimum size=1.2cm] { $|\alpha|+|\beta|...


4

You are almost done, you only need to change tip of brackets in block and replace matrix elements, where you like to have dots with \cdots for horizontal dots and \vdots for vertical: \documentclass{article} \usepackage{blkarray} \begin{document} \[T_i = \begin{blockarray}{ccccc} W_1 & W_2 & W_3 & \cdots & W_m \\ \begin{block}{[ccccc]} % &...


6

There is \bordermatrix macro in plain TeX: $$ \delcode`(=\delcode`[ \delcode`)=\delcode`] T_i = \bordermatrix{ & W_1 & W_2 & W_3 & \cdots & W_m \cr & e_{11} & e_{21} & e_{31} & \cdots & e_{m1} \cr & e_{12} & e_{22} & e_{32} & \cdots & e_{m2} \cr ...


8

With {bNiceMatrix} of nicematrix: \documentclass{article} \usepackage{nicematrix} \begin{document} \[T_i = \begin{bNiceMatrix}[first-row] W_1 & W_2 & W_3 & \cdots & W_m \\ e_{11} & e_{22} & e_{31} & \cdots & e_{m1} \\ e_{12} & e_{22} & e_{32} & \cdots & e_{m2} \\ e_{13} & e_{23} & e_{33} & \cdots ...


2

You could employ the amscd package, which is part of the amsmath bundle, to achieve your typesetting objective. See section 8, "Commutative diagrams", of the user guide of the amsmath package for a tutorial on this package. \documentclass{article} \usepackage{amscd} % for 'CD' ("commutative diagram") environment \usepackage{mathrsfs} %...


2

The following is a little cleaner. You create and append to a macro \@@genMatrix each element sequentially, then correct the addition of an opening &: \documentclass{article} \usepackage{amsmath} \usepackage{pgffor} \makeatletter \newcommand{\@genMatrix}[1]{{% \xdef\@@genMatrix{}% Clear \@@genMatrix \foreach \elem in {#1}{ \xdef\@@genMatrix{\@@...


Top 50 recent answers are included