Latex matrix formattingColumn and row padding in tablesSmaller matrices (or other math elements) in displayed...
Latex matrix formatting
Is there a theorem in Real analysis similar to Cauchy's theorem in Complex analysis?
How to ensure that neurotic or annoying characters don't get tiring on the long run
How many people need to succeed in a group check with three people?
Why does an orbit become hyperbolic when total orbital energy is positive?
Why 1.5fill is 0pt
Is there a generally agreed upon solution to Bradley's Infinite Regress without appeal to Paraconsistent Logic?
Exam design: give maximum score per question or not?
Permutations in Disguise
Did slaves have slaves?
Does household ovens ventilate heat to the outdoors?
Where is it? - The Google Earth Challenge Ep. 4
Is it acceptable to use decoupling capacitor ground pad as ground for oscilloscope probe?
Why does dd not make working bootable USB sticks for Microsoft?
Why is the year in this ISO timestamp not 2019?
Output Distinct Factor Cuboids
Floating Point XOR
What does the Free Recovery sign (UK) actually mean?
What is this WWII four-engine plane on skis?
Who are the people reviewing far more papers than they're submitting for review?
Is it better to use mosfet with gate driver IC or mosfet with lower VGs on
Which version of the Pigeonhole principle is correct? One is far stronger than the other
What is a "major country" as named in Bernie Sanders' Healthcare debate answers?
Are lay articles good enough to be the main source of information for PhD research?
Latex matrix formatting
Column and row padding in tablesSmaller matrices (or other math elements) in displayed mathBlock matrix with vectorsLeft aligning equations without align characterToeplitz matrix in LaTeXFormatting a Block MatrixCreating a matrix with column or row vectors as argumentsMultiple Matrix Formattingrepresentation of vector and matrix in latex
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am trying to create something similar to the below image. I have something but my formatting is a little off. How can I correct the formatting and also add the W1, W2, Wn and D letters on top (not a major issue however)?

documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
begin{bmatrix}
W_{11} \
W_{12} \
vdots \
W_{1n}
end{bmatrix}
&+ begin{bmatrix}
W_{21} \
W_{22} \
vdots \
W_{2n}
end{bmatrix}
&+ hdots
&+ begin{bmatrix}
W_{n1} \
W_{n2} \
vdots \
W_{nn}
end{bmatrix}
&= begin{bmatrix}
frac{W_{11} + W_{21} + hdots + W_{n1}}{n} \
frac{W_{12} + W_{22} + hdots + W_{n2}}{n} \
vdots \
frac{W_{1n} + W_{2n} + hdots + W_{nn}}{n}
end{bmatrix}
end{align}
end{document}
amsmath matrices vector
add a comment
|
I am trying to create something similar to the below image. I have something but my formatting is a little off. How can I correct the formatting and also add the W1, W2, Wn and D letters on top (not a major issue however)?

documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
begin{bmatrix}
W_{11} \
W_{12} \
vdots \
W_{1n}
end{bmatrix}
&+ begin{bmatrix}
W_{21} \
W_{22} \
vdots \
W_{2n}
end{bmatrix}
&+ hdots
&+ begin{bmatrix}
W_{n1} \
W_{n2} \
vdots \
W_{nn}
end{bmatrix}
&= begin{bmatrix}
frac{W_{11} + W_{21} + hdots + W_{n1}}{n} \
frac{W_{12} + W_{22} + hdots + W_{n2}}{n} \
vdots \
frac{W_{1n} + W_{2n} + hdots + W_{nn}}{n}
end{bmatrix}
end{align}
end{document}
amsmath matrices vector
add a comment
|
I am trying to create something similar to the below image. I have something but my formatting is a little off. How can I correct the formatting and also add the W1, W2, Wn and D letters on top (not a major issue however)?

documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
begin{bmatrix}
W_{11} \
W_{12} \
vdots \
W_{1n}
end{bmatrix}
&+ begin{bmatrix}
W_{21} \
W_{22} \
vdots \
W_{2n}
end{bmatrix}
&+ hdots
&+ begin{bmatrix}
W_{n1} \
W_{n2} \
vdots \
W_{nn}
end{bmatrix}
&= begin{bmatrix}
frac{W_{11} + W_{21} + hdots + W_{n1}}{n} \
frac{W_{12} + W_{22} + hdots + W_{n2}}{n} \
vdots \
frac{W_{1n} + W_{2n} + hdots + W_{nn}}{n}
end{bmatrix}
end{align}
end{document}
amsmath matrices vector
I am trying to create something similar to the below image. I have something but my formatting is a little off. How can I correct the formatting and also add the W1, W2, Wn and D letters on top (not a major issue however)?

documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
begin{bmatrix}
W_{11} \
W_{12} \
vdots \
W_{1n}
end{bmatrix}
&+ begin{bmatrix}
W_{21} \
W_{22} \
vdots \
W_{2n}
end{bmatrix}
&+ hdots
&+ begin{bmatrix}
W_{n1} \
W_{n2} \
vdots \
W_{nn}
end{bmatrix}
&= begin{bmatrix}
frac{W_{11} + W_{21} + hdots + W_{n1}}{n} \
frac{W_{12} + W_{22} + hdots + W_{n2}}{n} \
vdots \
frac{W_{1n} + W_{2n} + hdots + W_{nn}}{n}
end{bmatrix}
end{align}
end{document}
amsmath matrices vector
amsmath matrices vector
asked 8 hours ago
user113156user113156
1726 bronze badges
1726 bronze badges
add a comment
|
add a comment
|
2 Answers
2
active
oldest
votes
The following sets the arrangement inside an array, with the first row handling the labels on top of each bmatrix, while the second row sets each of the matrices/vectors. arraystretch has been increased to spread the content vertically.

documentclass{article}
usepackage{amsmath}
begin{document}
[
setlength{arraycolsep}{0pt}% No column separation in array; manual spacing
% by supplying empty groups {} around operators
renewcommand{arraystretch}{1.5}% Stretch out content vertically
begin{array}{ *{8}{c} }
% Header row in scriptstyle
scriptstyle W_1 & & % +
scriptstyle W_2 & & % + ... +
scriptstyle W_n & & & % = 1/n
scriptstyle D \
% Matrix/vector row
begin{bmatrix}
W_{11} \ W_{12} \ vdots \ W_{1n}
end{bmatrix}
& {} + {} &
begin{bmatrix}
W_{21} \ W_{22} \ vdots \ W_{2n}
end{bmatrix}
& {} + dots + {} &
begin{bmatrix}
W_{n1} \ W_{n2} \ vdots \ W_{nn}
end{bmatrix}
& {} = {} &
dfrac{1}{n} &
begin{bmatrix}
W_{11} + W_{21} + dots + W_{n1} \
W_{12} + W_{22} + dots + W_{n2} \
vdots \
W_{1n} + W_{2n} + dots + W_{nn}
end{bmatrix}
end{array}
]
end{document}
Since scalar multiplication of a vector results in each component being multiplied by the scalar, some simplification in the presentation makes things line up nicely.
1
The math doesn't make sense though...
– Werner
8 hours ago
Thats awesome! its looks better than what I was expecting. How would I reference this though in a document? The math is from a Natural Language Processing model where we have many documents and train a model to output vectors for each word. Once we have these vectors we average them to obtain a single vector for each document. Some better explanation here: yaronvazana.com/2018/09/20/…
– user113156
8 hours ago
The usual method for referencing such a structure is to give it an equation number. Instead of using[ ... ], wrap it in anequationenvironment, with alabel{...}inside.
– barbara beeton
1 hour ago
add a comment
|
A proposition with the mmatrix environment (medium size matrix) from nccmath and cellspace for a proper row spacing:
documentclass{article}
usepackage{amsmath, nccmath}
usepackage[math]{cellspace}
setlength{cellspacetoplimit}{2pt}
setlength{cellspacebottomlimit}{2pt}
newenvironment{bmmatrix}{begin{bmatrix} begin{mmatrix}}{end{mmatrix}end{bmatrix}}
begin{document}
begin{alignat}{3}
begin{matrix}
W_1 \
begin{bmmatrix}
W_{11} \
W_{12} \[-1.5ex]
vdots \
W_{1n}
end{bmmatrix}
end{matrix} &+ &
begin{matrix}
W_2 \
begin{bmmatrix}
W_{21} \
W_{22} \[-1.5ex]
vdots \
W_{2n}
end{bmmatrix}
end{matrix}
&+ hdots{}
&
+ begin{matrix}
W_n \
begin{bmmatrix}
W_{n1} \
W_{n2} \[-1.5ex]
vdots \
W_{nn}
end{bmmatrix}
end{matrix}
&=
begin{matrix}
D \
begin{bmatrix}
mfrac{W_{11} + W_{21} + hdots + W_{n1}}{n} \[-1ex]
smash[b]{ vdots }\[-0.5ex]
mfrac{W_{1n} + W_{2n} + hdots + W_{nn}}{n}
end{bmatrix}
end{matrix}
end{alignat}
end{document}

add a comment
|
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f508418%2flatex-matrix-formatting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The following sets the arrangement inside an array, with the first row handling the labels on top of each bmatrix, while the second row sets each of the matrices/vectors. arraystretch has been increased to spread the content vertically.

documentclass{article}
usepackage{amsmath}
begin{document}
[
setlength{arraycolsep}{0pt}% No column separation in array; manual spacing
% by supplying empty groups {} around operators
renewcommand{arraystretch}{1.5}% Stretch out content vertically
begin{array}{ *{8}{c} }
% Header row in scriptstyle
scriptstyle W_1 & & % +
scriptstyle W_2 & & % + ... +
scriptstyle W_n & & & % = 1/n
scriptstyle D \
% Matrix/vector row
begin{bmatrix}
W_{11} \ W_{12} \ vdots \ W_{1n}
end{bmatrix}
& {} + {} &
begin{bmatrix}
W_{21} \ W_{22} \ vdots \ W_{2n}
end{bmatrix}
& {} + dots + {} &
begin{bmatrix}
W_{n1} \ W_{n2} \ vdots \ W_{nn}
end{bmatrix}
& {} = {} &
dfrac{1}{n} &
begin{bmatrix}
W_{11} + W_{21} + dots + W_{n1} \
W_{12} + W_{22} + dots + W_{n2} \
vdots \
W_{1n} + W_{2n} + dots + W_{nn}
end{bmatrix}
end{array}
]
end{document}
Since scalar multiplication of a vector results in each component being multiplied by the scalar, some simplification in the presentation makes things line up nicely.
1
The math doesn't make sense though...
– Werner
8 hours ago
Thats awesome! its looks better than what I was expecting. How would I reference this though in a document? The math is from a Natural Language Processing model where we have many documents and train a model to output vectors for each word. Once we have these vectors we average them to obtain a single vector for each document. Some better explanation here: yaronvazana.com/2018/09/20/…
– user113156
8 hours ago
The usual method for referencing such a structure is to give it an equation number. Instead of using[ ... ], wrap it in anequationenvironment, with alabel{...}inside.
– barbara beeton
1 hour ago
add a comment
|
The following sets the arrangement inside an array, with the first row handling the labels on top of each bmatrix, while the second row sets each of the matrices/vectors. arraystretch has been increased to spread the content vertically.

documentclass{article}
usepackage{amsmath}
begin{document}
[
setlength{arraycolsep}{0pt}% No column separation in array; manual spacing
% by supplying empty groups {} around operators
renewcommand{arraystretch}{1.5}% Stretch out content vertically
begin{array}{ *{8}{c} }
% Header row in scriptstyle
scriptstyle W_1 & & % +
scriptstyle W_2 & & % + ... +
scriptstyle W_n & & & % = 1/n
scriptstyle D \
% Matrix/vector row
begin{bmatrix}
W_{11} \ W_{12} \ vdots \ W_{1n}
end{bmatrix}
& {} + {} &
begin{bmatrix}
W_{21} \ W_{22} \ vdots \ W_{2n}
end{bmatrix}
& {} + dots + {} &
begin{bmatrix}
W_{n1} \ W_{n2} \ vdots \ W_{nn}
end{bmatrix}
& {} = {} &
dfrac{1}{n} &
begin{bmatrix}
W_{11} + W_{21} + dots + W_{n1} \
W_{12} + W_{22} + dots + W_{n2} \
vdots \
W_{1n} + W_{2n} + dots + W_{nn}
end{bmatrix}
end{array}
]
end{document}
Since scalar multiplication of a vector results in each component being multiplied by the scalar, some simplification in the presentation makes things line up nicely.
1
The math doesn't make sense though...
– Werner
8 hours ago
Thats awesome! its looks better than what I was expecting. How would I reference this though in a document? The math is from a Natural Language Processing model where we have many documents and train a model to output vectors for each word. Once we have these vectors we average them to obtain a single vector for each document. Some better explanation here: yaronvazana.com/2018/09/20/…
– user113156
8 hours ago
The usual method for referencing such a structure is to give it an equation number. Instead of using[ ... ], wrap it in anequationenvironment, with alabel{...}inside.
– barbara beeton
1 hour ago
add a comment
|
The following sets the arrangement inside an array, with the first row handling the labels on top of each bmatrix, while the second row sets each of the matrices/vectors. arraystretch has been increased to spread the content vertically.

documentclass{article}
usepackage{amsmath}
begin{document}
[
setlength{arraycolsep}{0pt}% No column separation in array; manual spacing
% by supplying empty groups {} around operators
renewcommand{arraystretch}{1.5}% Stretch out content vertically
begin{array}{ *{8}{c} }
% Header row in scriptstyle
scriptstyle W_1 & & % +
scriptstyle W_2 & & % + ... +
scriptstyle W_n & & & % = 1/n
scriptstyle D \
% Matrix/vector row
begin{bmatrix}
W_{11} \ W_{12} \ vdots \ W_{1n}
end{bmatrix}
& {} + {} &
begin{bmatrix}
W_{21} \ W_{22} \ vdots \ W_{2n}
end{bmatrix}
& {} + dots + {} &
begin{bmatrix}
W_{n1} \ W_{n2} \ vdots \ W_{nn}
end{bmatrix}
& {} = {} &
dfrac{1}{n} &
begin{bmatrix}
W_{11} + W_{21} + dots + W_{n1} \
W_{12} + W_{22} + dots + W_{n2} \
vdots \
W_{1n} + W_{2n} + dots + W_{nn}
end{bmatrix}
end{array}
]
end{document}
Since scalar multiplication of a vector results in each component being multiplied by the scalar, some simplification in the presentation makes things line up nicely.
The following sets the arrangement inside an array, with the first row handling the labels on top of each bmatrix, while the second row sets each of the matrices/vectors. arraystretch has been increased to spread the content vertically.

documentclass{article}
usepackage{amsmath}
begin{document}
[
setlength{arraycolsep}{0pt}% No column separation in array; manual spacing
% by supplying empty groups {} around operators
renewcommand{arraystretch}{1.5}% Stretch out content vertically
begin{array}{ *{8}{c} }
% Header row in scriptstyle
scriptstyle W_1 & & % +
scriptstyle W_2 & & % + ... +
scriptstyle W_n & & & % = 1/n
scriptstyle D \
% Matrix/vector row
begin{bmatrix}
W_{11} \ W_{12} \ vdots \ W_{1n}
end{bmatrix}
& {} + {} &
begin{bmatrix}
W_{21} \ W_{22} \ vdots \ W_{2n}
end{bmatrix}
& {} + dots + {} &
begin{bmatrix}
W_{n1} \ W_{n2} \ vdots \ W_{nn}
end{bmatrix}
& {} = {} &
dfrac{1}{n} &
begin{bmatrix}
W_{11} + W_{21} + dots + W_{n1} \
W_{12} + W_{22} + dots + W_{n2} \
vdots \
W_{1n} + W_{2n} + dots + W_{nn}
end{bmatrix}
end{array}
]
end{document}
Since scalar multiplication of a vector results in each component being multiplied by the scalar, some simplification in the presentation makes things line up nicely.
answered 8 hours ago
WernerWerner
463k77 gold badges1039 silver badges1787 bronze badges
463k77 gold badges1039 silver badges1787 bronze badges
1
The math doesn't make sense though...
– Werner
8 hours ago
Thats awesome! its looks better than what I was expecting. How would I reference this though in a document? The math is from a Natural Language Processing model where we have many documents and train a model to output vectors for each word. Once we have these vectors we average them to obtain a single vector for each document. Some better explanation here: yaronvazana.com/2018/09/20/…
– user113156
8 hours ago
The usual method for referencing such a structure is to give it an equation number. Instead of using[ ... ], wrap it in anequationenvironment, with alabel{...}inside.
– barbara beeton
1 hour ago
add a comment
|
1
The math doesn't make sense though...
– Werner
8 hours ago
Thats awesome! its looks better than what I was expecting. How would I reference this though in a document? The math is from a Natural Language Processing model where we have many documents and train a model to output vectors for each word. Once we have these vectors we average them to obtain a single vector for each document. Some better explanation here: yaronvazana.com/2018/09/20/…
– user113156
8 hours ago
The usual method for referencing such a structure is to give it an equation number. Instead of using[ ... ], wrap it in anequationenvironment, with alabel{...}inside.
– barbara beeton
1 hour ago
1
1
The math doesn't make sense though...
– Werner
8 hours ago
The math doesn't make sense though...
– Werner
8 hours ago
Thats awesome! its looks better than what I was expecting. How would I reference this though in a document? The math is from a Natural Language Processing model where we have many documents and train a model to output vectors for each word. Once we have these vectors we average them to obtain a single vector for each document. Some better explanation here: yaronvazana.com/2018/09/20/…
– user113156
8 hours ago
Thats awesome! its looks better than what I was expecting. How would I reference this though in a document? The math is from a Natural Language Processing model where we have many documents and train a model to output vectors for each word. Once we have these vectors we average them to obtain a single vector for each document. Some better explanation here: yaronvazana.com/2018/09/20/…
– user113156
8 hours ago
The usual method for referencing such a structure is to give it an equation number. Instead of using
[ ... ], wrap it in an equation environment, with a label{...} inside.– barbara beeton
1 hour ago
The usual method for referencing such a structure is to give it an equation number. Instead of using
[ ... ], wrap it in an equation environment, with a label{...} inside.– barbara beeton
1 hour ago
add a comment
|
A proposition with the mmatrix environment (medium size matrix) from nccmath and cellspace for a proper row spacing:
documentclass{article}
usepackage{amsmath, nccmath}
usepackage[math]{cellspace}
setlength{cellspacetoplimit}{2pt}
setlength{cellspacebottomlimit}{2pt}
newenvironment{bmmatrix}{begin{bmatrix} begin{mmatrix}}{end{mmatrix}end{bmatrix}}
begin{document}
begin{alignat}{3}
begin{matrix}
W_1 \
begin{bmmatrix}
W_{11} \
W_{12} \[-1.5ex]
vdots \
W_{1n}
end{bmmatrix}
end{matrix} &+ &
begin{matrix}
W_2 \
begin{bmmatrix}
W_{21} \
W_{22} \[-1.5ex]
vdots \
W_{2n}
end{bmmatrix}
end{matrix}
&+ hdots{}
&
+ begin{matrix}
W_n \
begin{bmmatrix}
W_{n1} \
W_{n2} \[-1.5ex]
vdots \
W_{nn}
end{bmmatrix}
end{matrix}
&=
begin{matrix}
D \
begin{bmatrix}
mfrac{W_{11} + W_{21} + hdots + W_{n1}}{n} \[-1ex]
smash[b]{ vdots }\[-0.5ex]
mfrac{W_{1n} + W_{2n} + hdots + W_{nn}}{n}
end{bmatrix}
end{matrix}
end{alignat}
end{document}

add a comment
|
A proposition with the mmatrix environment (medium size matrix) from nccmath and cellspace for a proper row spacing:
documentclass{article}
usepackage{amsmath, nccmath}
usepackage[math]{cellspace}
setlength{cellspacetoplimit}{2pt}
setlength{cellspacebottomlimit}{2pt}
newenvironment{bmmatrix}{begin{bmatrix} begin{mmatrix}}{end{mmatrix}end{bmatrix}}
begin{document}
begin{alignat}{3}
begin{matrix}
W_1 \
begin{bmmatrix}
W_{11} \
W_{12} \[-1.5ex]
vdots \
W_{1n}
end{bmmatrix}
end{matrix} &+ &
begin{matrix}
W_2 \
begin{bmmatrix}
W_{21} \
W_{22} \[-1.5ex]
vdots \
W_{2n}
end{bmmatrix}
end{matrix}
&+ hdots{}
&
+ begin{matrix}
W_n \
begin{bmmatrix}
W_{n1} \
W_{n2} \[-1.5ex]
vdots \
W_{nn}
end{bmmatrix}
end{matrix}
&=
begin{matrix}
D \
begin{bmatrix}
mfrac{W_{11} + W_{21} + hdots + W_{n1}}{n} \[-1ex]
smash[b]{ vdots }\[-0.5ex]
mfrac{W_{1n} + W_{2n} + hdots + W_{nn}}{n}
end{bmatrix}
end{matrix}
end{alignat}
end{document}

add a comment
|
A proposition with the mmatrix environment (medium size matrix) from nccmath and cellspace for a proper row spacing:
documentclass{article}
usepackage{amsmath, nccmath}
usepackage[math]{cellspace}
setlength{cellspacetoplimit}{2pt}
setlength{cellspacebottomlimit}{2pt}
newenvironment{bmmatrix}{begin{bmatrix} begin{mmatrix}}{end{mmatrix}end{bmatrix}}
begin{document}
begin{alignat}{3}
begin{matrix}
W_1 \
begin{bmmatrix}
W_{11} \
W_{12} \[-1.5ex]
vdots \
W_{1n}
end{bmmatrix}
end{matrix} &+ &
begin{matrix}
W_2 \
begin{bmmatrix}
W_{21} \
W_{22} \[-1.5ex]
vdots \
W_{2n}
end{bmmatrix}
end{matrix}
&+ hdots{}
&
+ begin{matrix}
W_n \
begin{bmmatrix}
W_{n1} \
W_{n2} \[-1.5ex]
vdots \
W_{nn}
end{bmmatrix}
end{matrix}
&=
begin{matrix}
D \
begin{bmatrix}
mfrac{W_{11} + W_{21} + hdots + W_{n1}}{n} \[-1ex]
smash[b]{ vdots }\[-0.5ex]
mfrac{W_{1n} + W_{2n} + hdots + W_{nn}}{n}
end{bmatrix}
end{matrix}
end{alignat}
end{document}

A proposition with the mmatrix environment (medium size matrix) from nccmath and cellspace for a proper row spacing:
documentclass{article}
usepackage{amsmath, nccmath}
usepackage[math]{cellspace}
setlength{cellspacetoplimit}{2pt}
setlength{cellspacebottomlimit}{2pt}
newenvironment{bmmatrix}{begin{bmatrix} begin{mmatrix}}{end{mmatrix}end{bmatrix}}
begin{document}
begin{alignat}{3}
begin{matrix}
W_1 \
begin{bmmatrix}
W_{11} \
W_{12} \[-1.5ex]
vdots \
W_{1n}
end{bmmatrix}
end{matrix} &+ &
begin{matrix}
W_2 \
begin{bmmatrix}
W_{21} \
W_{22} \[-1.5ex]
vdots \
W_{2n}
end{bmmatrix}
end{matrix}
&+ hdots{}
&
+ begin{matrix}
W_n \
begin{bmmatrix}
W_{n1} \
W_{n2} \[-1.5ex]
vdots \
W_{nn}
end{bmmatrix}
end{matrix}
&=
begin{matrix}
D \
begin{bmatrix}
mfrac{W_{11} + W_{21} + hdots + W_{n1}}{n} \[-1ex]
smash[b]{ vdots }\[-0.5ex]
mfrac{W_{1n} + W_{2n} + hdots + W_{nn}}{n}
end{bmatrix}
end{matrix}
end{alignat}
end{document}

edited 5 hours ago
answered 7 hours ago
BernardBernard
191k8 gold badges86 silver badges226 bronze badges
191k8 gold badges86 silver badges226 bronze badges
add a comment
|
add a comment
|
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f508418%2flatex-matrix-formatting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown