Tag Info

New answers tagged

5

If you are willing to live under the constraint that all matrix elements occupy the same width (though your question implies that such a constraint may actually be a desirable requirement), then this \sqmatrix[alignment]{content} macro will do the "squaring" automatically. Inter-element spacing (default 0pt) may be specified with \setstacktabbedgap{length}. ...


11

Adjust \arraystretch to an appropriate factor: \documentclass{article} \usepackage{amsmath} \begin{document} \[ \renewcommand{\arraystretch}{1.3} \begin{bmatrix} \times & \times & \times & & & & & & \\ \times & \times & & \times & \times & ...


4

You could set the height of each line manually providing the line height in square brackets after each line end: \times & \times & ... & \times\\[1ex] To give all lines the same height, you can use a macro: \documentclass{article} \usepackage{amsmath} \newcommand{\squarelineheight}{0.9ex} \begin{document} \[ \left[ \begin{matrix} \times ...


0

There are multiple things you could do: As people in the comments said you should try without the backslashes You can try array instead: \begin{align} M=\left[ \begin{array}{c c c c c} 1 & 2 & 3 & 4 & 5\\ 3 & 4 & 5 & 6 & 7 \end{array}\right] \end{align} array works the same way as tabular(for math mode) so you have ...


4

This uses a stacking approach. This answer is helping me to think of ways to automate dotted/dashed lines as part of stacks, which in this MWE, had to be done very manually. \documentclass{article} \usepackage[usestackEOL]{stackengine} \usepackage{graphicx} \stackMath % DASHED LINE OF SPECIFIED LENGTH % From morsburg at ...


6

Since revtex4 seems to be incompatible with the arydshln package, here's an option using TikZ: \documentclass[aps,prl,twocolumn,nofootinbib,superscriptaddress,floatfix]{revtex4} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \[ \Biggl(\mkern-5mu \begin{tikzpicture}[baseline=-.65ex] \matrix[ matrix of math nodes, column sep=1ex, ] (m) { B ...


9

You can adjust the dash and gap of the \hdashline by modifying the lengths \dashlinedash and \dashlinegap: \documentclass{article} \usepackage{tabularx} \usepackage{arydshln,leftidx,mathtools} \setlength{\dashlinedash}{.4pt} \setlength{\dashlinegap}{.8pt} \begin{document} \[ \leftidx{_{m-r}^{\phantom{m-r}\llap{$\scriptstyle r$}}}{\left( ...


1

Here is an adaptation of: Highlight elements in the matrix and Custom and built in TikZ fill patterns which achieves: Note that you can overwrite existing entries with fill=white (as in the first example) or just leave them blank as in the second example. Notes: This does require two runs: the first to compute the positions of the box, and the ...


4

Please test the code before posting, your code had multiple errors ! LaTeX Error: Illegal character in array arg. ! Extra alignment tab has been changed to \cr. ! Too many }'s. ! LaTeX Error: \begin{document} ended by \end{figure}. So I had to guess fixes for those to guess the problem that you were actually facing which is that you had put the brace ...


3

This is just a manual placement of the respective braces in a nested array: \documentclass{article} \usepackage{amsmath,amssymb,array,graphicx} \newcolumntype{C}[1]{>{\centering\arraybackslash$}p{#1}<{$}} \begin{document} \[ \begin{array}{@{}r@{}} \overbrace{\begin{array}{@{}*{5}{C{1.5em}}@{}} &&&& ...


6

Just move the \centering out of the math material enclosed in $...$. \documentclass[a4paper]{article} \usepackage{amsmath} \begin{document} \begin{figure}[ht] \centering $\begin{bmatrix} 0 & C_l & 0 & 0 & \dots & \dots & \dots & 0 \\ 0 & 0 & ...


5

If you want a figure (floating), replace $\begin{bmatrix} ... $ with \begin{equation*}\begin{bmatrix} ... \end{equation*}: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{figure}[ht] \centering \begin{equation*} \begin{bmatrix} 0 & C_l & 0 & 0 & \dots & \dots & ...


2

My solution is suited for 'fixed' positioning of content with a caption, i.e. the content should not float around. \documentclass[10pt]{scrbook} \usepackage{caption} \usepackage{amsmath} \begin{document} \chapter{My very sophisticated matrix} \begingroup \centering% \(% \begin{bmatrix}% 0 & C_l & 0 & 0 ...


2

\documentclass[12pt]{article} \begin{document} \[ \begin{array}{r @{} c @{} l} ( & 2 \quad,\quad3 & )\\ \Bigg[ & \begin{array}{cr} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \\ \end{array} & \Bigg] \end{array} \] \end{document}


3

Note that $$...$$ shouldn't be used in LaTeX, see Why is \[ ... \] preferable to $$ ... $$?; also a4wide is a deprecated package. If you want to widen the text area, use geometry. You can obtain what you want with blkarray: \documentclass[12pt]{article} \usepackage{amsmath,blkarray} \begin{document} \[ \begin{blockarray}{cc} \begin{block}{(c@{\rlap{,}}c)} ...


3

Here is a way to do it "manually." \documentclass{article} \usepackage{amsbsy} \newcommand*{\clap}[1]{\hbox to 0pt{\hss#1\hss}} \newcommand*{\mat}[1]{\boldsymbol{\mathrm{#1}}} \newcommand*{\subdims}[3]{\clap{\raisebox{#1}[0pt][0pt]{$\scriptstyle(#2 \times #3)$}}} \fboxrule=1pt \begin{document} \Huge \[ ...


7

Here I do it with stacks, setting the indices below the boxes. The primary macro is \matbox{rows}{columns}{row index}{column index}{matrix name}. A helper macro is \raiserows, which is like a \raisebox, except that the "length" is specified in rows, not actual length. Note that in the MWE, because X has 7 rows, while P^T only has 2 rows, P^T must be ...


2

This is one possible solution via amsmath package. Code \documentclass[12pt]{article} \usepackage[margin=1cm,paper size={20cm,5cm}]{geometry} \usepackage{amsmath,amssymb} \thispagestyle{empty} \begin{document} \[ {\begin{pmatrix} & & \\ & X &\\ & & \end{pmatrix} \mkern-10mu}_{I \times J}= {\begin{pmatrix} ...


2

Please always post complete documents which generate the error. In particular it allows you to check that the fragment you are posting does in fact generate an error. The fragment in your question does not generate an error, also the error messages are not complete TeX error messages. However I would guess your real document os something like this, which ...



Top 50 recent answers are included