New answers tagged

0

Taking into account your picture of desired table in question and your own answer I combine in the following code: \documentclass{article} \usepackage{multirow} \begin{document} \begin{tabular}{|*{4}{c|}} \cline{3-4} \multicolumn{2}{c}{} & \multicolumn{2}{|c|}{Predictions} ...


0

Thanks to salim bou I was able to achieve what I wanted. The code below strips ''Predictions'' and ''Guesses'' of all lines. \begin{tabular}{l|l|l|l|} \multicolumn{2}{l}{} & \multicolumn{2}{c}{Predictions} \\ \cline{3-4} \multicolumn{2}{c|}{} & High & Low \\ ...


1

Like this \documentclass{article} \usepackage{multirow} \begin{document} \begin{tabular}{|l|c|l|l|} \multicolumn{2}{c}{} & \multicolumn{2}{c}{Predictions} \\ \cline{3-4} \multicolumn{2}{c|}{} & High & Low \\ \hline \multirow{2}{*}{Guesses} & High & 14 & 0 \\ \cline{2-4} & ...


3

Not really recursive. But, hey, it works! \documentclass{article} \usepackage{amsmath} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\recursematrix}{O{B}m} {% #1 is the (optional) symbol for the coefficient, #2 is the step \begin{pmatrix} \passerby_recursematrix:nn { #1 } { #2 } \end{pmatrix} } \tl_new:N \l_passerby_recursebody_tl ...


3

I think the first two matrices are what the OP asked for. I believe I have got the 3rd level, as well. The key is in realizing that the indices are basically in binary (base 2) notation. EDIT, To keep up with egreg, I also did 4th level. \documentclass[landscape]{article} \usepackage[margin=1cm]{geometry} \usepackage{amsmath} \newcommand\Amatrix[2]{% ...


1

FWIW, I've ended up giving up on \matrix{} and use handmade positioning: \documentclass{standalone} \usepackage{keycommand} \usepackage{tikz} \usetikzlibrary{positioning,calc} \newkeycommand{\myrow}[keyA=defaultA, keyB=defaultB, keyC=defaultC]{% \node (A) at ($(0, 0) - (pos)$) [anchor=east]{\commandkey{keyA}}; \node (B) at ($(4, 0) - (pos)$) ...


1

A solution with pstricks: \documentclass{article} \usepackage{pst-node, pst-plot} \usepackage{auto-pst-pdf} \def\fput(#1)#2{\rput(#1){\psframebox*{$#2$}}} \begin{document} \begin{pspicture}(0,0)(8,6) \psset{dy=-1, labels=none, ticks=none, xunit =0.8, yunit=-0.5, linejoin=1,arrowinset=0.15} \psline{ <->}(0,10)(0,0)(11,0) ...


2

Using the dcases environment inside a pmatrix: \documentclass{article} \usepackage{mathtools} \usepackage{eqparbox} \begin{document} \[ P = \begin{pmatrix*}[l] \begin{dcases} \eqmakebox[V][l]{$ p^{(1)}(x_1,x_2,\dots,x_{r_1}) $} \\ \eqmakebox[V]{$ \vdots $} \\ \eqmakebox[V][l]{$ p^{(m_1)}(x_1,x_2,\dots,x_{r_1}) $} \end{dcases} \\ ...


2

You need to nest array or matrix. \documentclass{article} \usepackage{mathtools} \begin{document} \begin{figure}[h] \centering \[ P = \left(\begin{array}{l} \left\{\begin{array}{l} p^{(1)}(x_1,x_2,\cdots,x_{r_1}) \\ \vdots \\ p^{(m_1)}(x_1,x_2,\cdots,x_{r_1}) \end{array}\right. \\ ...


3

I propose a slight improvement to @campa's solution, to have a better alignment of the vertical dots: \documentclass{article} \usepackage{mathtools} \usepackage{eqparbox} \begin{document} \[ P=\begin{pmatrix*}[l] \eqmakebox[P][l]{$ p^{(1)}(x₁,x₂, ⋯ ,x_{r₁}) $} \\ \eqmakebox[P]{$ ⋮ $}\\ \eqmakebox[P]{$ p^{(m₁)}(x₁,x₂, ⋯ ,x_{r₁}) $}\\ ...


5

The mathtools package provides some extensions to the amsmath package. In particular, a starred version of all matrix environments, which takes an alignment optional parameter. \documentclass{article} \usepackage{mathtools} \begin{document} \[ P=\begin{pmatrix*}[l] p^{(1)}(x_1,x_2,\cdots,x_{r_1}) \\ \vdots\\ p^{(m_1)}(x_1,x_2,\cdots,x_{r_1}) \\ ...


7

I assume, that you like to have left aligned (now is as is standard for matrices/vector notation. In this case the `array become handy: \documentclass{article} \begin{document} \[ P=\left(\begin{array}{l} p^{(1)}(x_1,x_2,\cdots,x_{r_1}) \\ \vdots\\ p^{(m_1)}(x_1,x_2,\cdots, x_{r_1}) \\ p^{(m_1+1)}(x_1,x_2,\cdots,x_{r_1}, ...


2

What are all those zeros good for, why not just write that this is a diagonal matrix with these entries: \documentclass[12pt,a4paper]{report} \usepackage{amsmath,mathtools} \DeclareMathOperator\diag{diag} \begin{document} \begin{equation} \begin{split} Y_{12} = -\diag\Bigl( & \frac{1}{x'_{d1}}, \frac{1}{x'_{d2}}, \frac{1}{x'_{d3}}, ...


1

Change the value of \arraycolsep or reduce the size of the font with the \medmath command from nccmath(about 80 % of displaystyle). You also can load geometry to have more sensible margins, if you don't use margin notes. \documentclass[12pt,a4paper]{report} \usepackage{mathtools, nccmath} \usepackage{showframe} ...


1

The value of \arraystrech is set elsewhere but commenting that out didn't help. It seems that the default value was also not appropriate. So I put the \align inside a group and then checked a couple of \arraystrech values until I found the right one. Thank you everyone! \begingroup \renewcommand*{\arraystretch}{2} \begin{align} &\begin{bmatrix} 0 & ...


0

(Not a real answer, just a MWE placeholder.) As Mico indicated, your result can't be reproduced with what you provided. Below is a MWE with the minimum amount of uncommented code. None of the packages you mentioned make any difference in the output, so they've been commented out. Whatever is causing the bad alignment is elsewhere in your actual document. ...


5

One approach is to right-align both matrices, using \begin{bmatrix*}[r]…\end{bmatrix*} (from the mathtools package) instead of bmatrix. Then, adding \phantom{-}0 to entries in the second and third columns of the first matrix will add the correct amount of space. \documentclass{article} \usepackage{mathtools} \begin{document} \begin{align} % ...


1

Because this is typical non-LaTeX specific question (because this is question of type: give me a code, I don't want to think about it), I can reply: use simply \pmatrix or \matrix. Edit The result exactly the same as in the answer above can be accomplished by the code: \def\mmatrix#1#2#3{\left#1\matrix{#2}\right#3} $$ \pmatrix {\alpha_1 \cr \alpha_2 ...


12

A column vector is just a matrix with one column (from a typesetting point of view ;-)), so just use one of the various matrix possibilities and typeset with \\ to switch to the next row. Of course, mathmode is needed for this. \documentclass{article} \usepackage{mathtools} \begin{document} $ \begin{pmatrix} \alpha_{1} \\ \alpha_{2} \\ \vdots \\ ...


0

You can get inspiration from the macro \vdotfill<number of lines> shown in this code: \def\vdotfill#1{\vtop to0pt{\null \dimen0=#1\baselineskip\advance\dimen0 by-.4ex \kern-1.6ex \cleaders\hbox{\lower.4ex\vbox to1ex{}.}\vskip\dimen0 \vss}} $$ \pmatrix{ x_{11} & x_{12} & x_{13} & \vdotfill4 & x_{1n} \cr x_{21} & ...


4

Some suggestions: Replace the \cline{3-4} directives with \cline{3-5} Replace & \multicolumn{2}{c}{Player $2$} & \multicolumn{1}{c}{} with & \multicolumn{3}{c}{Player $2$}, i.e., let Player $2$ span all three columns Replace \multirow{2}*{Player $1$} with Player $1$ and move the instruction down one row, to the row labelled "B". ...


0

This is probably a horrible idea because it is more a brute-force method, but here's how I would do it: \documentclass[12pt,a4paper]{article} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture} \matrix(m)[matrix of math nodes, row sep=2em, column sep=2em, text height=1.5ex, text depth=0.25ex] { x_{11} & x_{12} & x_{13} ...


4

Converting my comment to an answer, LaTeX has a both text and math modes. A number of commands intended for math mode use can only be invoked inside math mode. Attempts to invoke them in text mode will receive a "missing $ inserted" error. To enter math mode in LaTeX, one can enter inline math with dollar delimiters $...$. Many argue a preferable way to ...


4

Option ampersand replacement allows you to define which symbol to use instead of & in matrix environments. More detailed information in 20.5 Considerations Concerning Active Characters \documentclass{article} \usepackage{tikz, amsmath} \usetikzlibrary{shapes, positioning} \begin{document} \tikzstyle{block} = [draw, rectangle, align=center] ...


1

You could use your code inside the align environment: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align} \mathbf{M} &= \mathbf{U}\Sigma \mathbf{V}^{*} \nonumber\\ &= \mathbf{U}\left[\begin{array}{cccc} \sigma_{1} & 0 & \ldots & 0\\ 0 & \sigma_{2} & \ldots & ...


0

This should work for simple vectors, but you may need \vphantom instead of \mathstrut for larger entries. \documentclass{article} \usepackage{mathtools} \begin{document} \begin{equation} \begin{bmatrix}a\\b\\c\end{bmatrix} \begin{array}{@{}c@{}} \begin{bmatrix}d&e&f\end{bmatrix}\\ \mathstrut\\ \mathstrut \end{array} \end{equation} \end{document} ...


0

arydshln doesn't mention bmatrix environment, so I've tested your code with array and it worked. \documentclass[xcolor=dvipsnames, fleqn]{beamer} \usepackage{arydshln} % for cdashline \begin{document} \begin{frame} \begin{align*} \left[\begin{array}{c:cc} \phantom{+}1 & -1 & \phantom{+}1 \\ \cdashline{1-3} -1 & \phantom{+}1 & -1 \\ ...


3

Wolfram Alpha recognizes \cdot, but it is not a full TeX parser. Example for the matrix syntax in Wolfram Alpha (Examples > Mathematics > Matrices & Linear Algebra): {{6, -7, 10}, {0, 3, -1}, {0, 5, -7}} The following example defines a macro \wapmatrix, which takes a nested comma separated list as matrix like the syntax for Wolfram Alpha and writes ...


6

Load amsmath and type, say: \[\begin{bmatrix} a&b&c\\ d&e&f\\ g&h&i\\ k&l&m \end{bmatrix}\] if you want a bracketed matrix, pmatrix for a matrix with parentheses, vmatrix for a determinant or Vmatrix for a matrix with double rules. Loading mathtools (needless to load amsmath in this case), you may use the ...



Top 50 recent answers are included