Drawing a matrixDiagonal lines in table cellHow to typeset block matrices?Smaller matrices (or other math elements) in displayed mathSpecific blockmatricesHow to highlight a single element in a matrix?How to create elegant stripped regions in matrix along with numbering of the rows and columnsHow to create augmented matrix in iBook Author using LaTeXMatrices with big zero and linesAligning underset below matrix equationBig matrix in two partsrepresentation of vector and matrix in latex
HackerRank: Electronics Shop
Supporting developers who insist on using their pet language
Mistakenly modified `/bin/sh'
What is the German equivalent of 干物女 (dried fish woman)?
Cubic programming and beyond?
Possible isometry groups of open manifolds
Integral clarification
As a DM, how to avoid unconscious metagaming when dealing with a high AC character?
How to draw a gif with expanding circles that reveal lines connecting a non-centered point to the expanding circle using Tikz
Why limit to revolvers?
What is the English equivalent of 干物女 (dried fish woman)?
Do native speakers use ZVE or CPU?
What impact would a dragon the size of Asia have on the environment?
How would someone destroy a black hole that’s at the centre of a planet?
Published paper containing well-known results
Project Euler, problem # 9, Pythagorean triplet
Filtering fine silt/mud from water (not necessarily bacteria etc.)
Can I activate an iPhone without an Apple ID?
What's the difference between soft PWM and PWM
Why do candidates not quit if they no longer have a realistic chance to win in the 2020 US presidents election
Ragged justification of captions depending on odd/even page
Why is dry soil hydrophobic? Bad gardener paradox
3D-Plot with an inequality condition for parameter values
Book or series about stones and a magician named Gwydion
Drawing a matrix
Diagonal lines in table cellHow to typeset block matrices?Smaller matrices (or other math elements) in displayed mathSpecific blockmatricesHow to highlight a single element in a matrix?How to create elegant stripped regions in matrix along with numbering of the rows and columnsHow to create augmented matrix in iBook Author using LaTeXMatrices with big zero and linesAligning underset below matrix equationBig matrix in two partsrepresentation of vector and matrix in latex
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I’m new to latex and I need your help with the matrix in the picture below:

mwe
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarrayccccc
beginblockc(cccc)
a & 2173.00 & 354.00 & 0.00 & 1249.00smash[b]vphantomBig \
b & 0.00 & 3772.00 & 52.00 & 0.00 \
c & 474.00 & 469.00 & 2858.00 & 42.00 \
d & 1262.00 & 303.00 & 39.00 & 2180.00smash[t]vphantomBig\
endblock
& a & b & c & d
endblockarray
]
enddocument
matrices
add a comment |
I’m new to latex and I need your help with the matrix in the picture below:

mwe
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarrayccccc
beginblockc(cccc)
a & 2173.00 & 354.00 & 0.00 & 1249.00smash[b]vphantomBig \
b & 0.00 & 3772.00 & 52.00 & 0.00 \
c & 474.00 & 469.00 & 2858.00 & 42.00 \
d & 1262.00 & 303.00 & 39.00 & 2180.00smash[t]vphantomBig\
endblock
& a & b & c & d
endblockarray
]
enddocument
matrices
add a comment |
I’m new to latex and I need your help with the matrix in the picture below:

mwe
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarrayccccc
beginblockc(cccc)
a & 2173.00 & 354.00 & 0.00 & 1249.00smash[b]vphantomBig \
b & 0.00 & 3772.00 & 52.00 & 0.00 \
c & 474.00 & 469.00 & 2858.00 & 42.00 \
d & 1262.00 & 303.00 & 39.00 & 2180.00smash[t]vphantomBig\
endblock
& a & b & c & d
endblockarray
]
enddocument
matrices
I’m new to latex and I need your help with the matrix in the picture below:

mwe
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarrayccccc
beginblockc(cccc)
a & 2173.00 & 354.00 & 0.00 & 1249.00smash[b]vphantomBig \
b & 0.00 & 3772.00 & 52.00 & 0.00 \
c & 474.00 & 469.00 & 2858.00 & 42.00 \
d & 1262.00 & 303.00 & 39.00 & 2180.00smash[t]vphantomBig\
endblock
& a & b & c & d
endblockarray
]
enddocument
matrices
matrices
asked Jul 6 at 7:09
jassonpottersenjassonpottersen
706 bronze badges
706 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Welcome to TeX-SE! You already have everything, you only need to make minor adjustments of the layout, and change the contents of the cells.
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarraylccc
textRatings & textbook_1 & textbook_2 & textbook_3 \
beginblockl(ccc)
textuser_1 & - & 1 & - smash[b]vphantomBig\
textuser_2 & - & 5 & - \
textuser_3 & 4 & - & - \
textuser_4 & - & - & 2smash[t]vphantomBig\
endblock
endblockarray
]
enddocument

You could make the user and book texts italic (thanks to @naveganTeX for bringing this up!).
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarraylccc
textRatings & textitbook_1 & textitbook_2 & textitbook_3 \
beginblockl(ccc)
textituser_1 & - & 1 & - smash[b]vphantomBig\
textituser_2 & - & 5 & - \
textituser_3 & 4 & - & - \
textituser_4 & - & - & 2smash[t]vphantomBig\
endblock
endblockarray
]
enddocument

A very quickly written tikz version:
documentclassarticle
usepackageamsmath
usepackagetikz
usetikzlibrarymatrix,positioning
begindocument
begintikzpicture
matrix [matrix of math nodes,left delimiter=(,right delimiter=),
row sep=0.2em,column sep=2em] (m)
- & 1 & - \
- & 5 & - \
4 & - & - \
- & - & 2\;
foreach X in 1,...,4
node[anchor=east] (uX) at ([xshift=-1em]m.west
foreach X in 1,...,3
m-1-X)$textbook_X$;
draw ([yshift=0.3em]m.north west) -- ++ (-4em,1em);
node[anchor=south east] at ([yshift=0.02em]u1.north east) Ratings;
node[left=0.02em of b1,yshift=0.5em] Movies;
endtikzpicture
enddocument

1
Great! I wanted to ask you if the words “user” and “book” aren’t in math mode?
– NaveganTeX
Jul 6 at 7:32
1
@naveganTeX This is a design choice. If anything one could replacetextbytextitforbookanduser, I think pure math mode would be "wrong". Writing answers is always a bit of a gamble, and my guess was that the one who produced the original screen shot used math mode only because they didn't know about the text command, but this may be a completely wrong guess.
– marmot
Jul 6 at 7:32
I would like to know if it is possible to draw a diagonal where it says “Ratings” and make it look like MoviesRatings?
– jassonpottersen
Jul 6 at 9:02
1
@jassonpottersen Yes, it is possible but if you aim at adding more features of that type you may be better off if you draw the matrix with TikZ. See here for a bunch of option.
– marmot
Jul 6 at 9:05
Mmm, it is throwing me an error. It does not work with blkarray, maybe just with tables?
– jassonpottersen
Jul 6 at 9:17
|
show 2 more comments
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/3.0/"u003ecc by-sa 3.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%2f498840%2fdrawing-a-matrix%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Welcome to TeX-SE! You already have everything, you only need to make minor adjustments of the layout, and change the contents of the cells.
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarraylccc
textRatings & textbook_1 & textbook_2 & textbook_3 \
beginblockl(ccc)
textuser_1 & - & 1 & - smash[b]vphantomBig\
textuser_2 & - & 5 & - \
textuser_3 & 4 & - & - \
textuser_4 & - & - & 2smash[t]vphantomBig\
endblock
endblockarray
]
enddocument

You could make the user and book texts italic (thanks to @naveganTeX for bringing this up!).
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarraylccc
textRatings & textitbook_1 & textitbook_2 & textitbook_3 \
beginblockl(ccc)
textituser_1 & - & 1 & - smash[b]vphantomBig\
textituser_2 & - & 5 & - \
textituser_3 & 4 & - & - \
textituser_4 & - & - & 2smash[t]vphantomBig\
endblock
endblockarray
]
enddocument

A very quickly written tikz version:
documentclassarticle
usepackageamsmath
usepackagetikz
usetikzlibrarymatrix,positioning
begindocument
begintikzpicture
matrix [matrix of math nodes,left delimiter=(,right delimiter=),
row sep=0.2em,column sep=2em] (m)
- & 1 & - \
- & 5 & - \
4 & - & - \
- & - & 2\;
foreach X in 1,...,4
node[anchor=east] (uX) at ([xshift=-1em]m.west
foreach X in 1,...,3
m-1-X)$textbook_X$;
draw ([yshift=0.3em]m.north west) -- ++ (-4em,1em);
node[anchor=south east] at ([yshift=0.02em]u1.north east) Ratings;
node[left=0.02em of b1,yshift=0.5em] Movies;
endtikzpicture
enddocument

1
Great! I wanted to ask you if the words “user” and “book” aren’t in math mode?
– NaveganTeX
Jul 6 at 7:32
1
@naveganTeX This is a design choice. If anything one could replacetextbytextitforbookanduser, I think pure math mode would be "wrong". Writing answers is always a bit of a gamble, and my guess was that the one who produced the original screen shot used math mode only because they didn't know about the text command, but this may be a completely wrong guess.
– marmot
Jul 6 at 7:32
I would like to know if it is possible to draw a diagonal where it says “Ratings” and make it look like MoviesRatings?
– jassonpottersen
Jul 6 at 9:02
1
@jassonpottersen Yes, it is possible but if you aim at adding more features of that type you may be better off if you draw the matrix with TikZ. See here for a bunch of option.
– marmot
Jul 6 at 9:05
Mmm, it is throwing me an error. It does not work with blkarray, maybe just with tables?
– jassonpottersen
Jul 6 at 9:17
|
show 2 more comments
Welcome to TeX-SE! You already have everything, you only need to make minor adjustments of the layout, and change the contents of the cells.
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarraylccc
textRatings & textbook_1 & textbook_2 & textbook_3 \
beginblockl(ccc)
textuser_1 & - & 1 & - smash[b]vphantomBig\
textuser_2 & - & 5 & - \
textuser_3 & 4 & - & - \
textuser_4 & - & - & 2smash[t]vphantomBig\
endblock
endblockarray
]
enddocument

You could make the user and book texts italic (thanks to @naveganTeX for bringing this up!).
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarraylccc
textRatings & textitbook_1 & textitbook_2 & textitbook_3 \
beginblockl(ccc)
textituser_1 & - & 1 & - smash[b]vphantomBig\
textituser_2 & - & 5 & - \
textituser_3 & 4 & - & - \
textituser_4 & - & - & 2smash[t]vphantomBig\
endblock
endblockarray
]
enddocument

A very quickly written tikz version:
documentclassarticle
usepackageamsmath
usepackagetikz
usetikzlibrarymatrix,positioning
begindocument
begintikzpicture
matrix [matrix of math nodes,left delimiter=(,right delimiter=),
row sep=0.2em,column sep=2em] (m)
- & 1 & - \
- & 5 & - \
4 & - & - \
- & - & 2\;
foreach X in 1,...,4
node[anchor=east] (uX) at ([xshift=-1em]m.west
foreach X in 1,...,3
m-1-X)$textbook_X$;
draw ([yshift=0.3em]m.north west) -- ++ (-4em,1em);
node[anchor=south east] at ([yshift=0.02em]u1.north east) Ratings;
node[left=0.02em of b1,yshift=0.5em] Movies;
endtikzpicture
enddocument

1
Great! I wanted to ask you if the words “user” and “book” aren’t in math mode?
– NaveganTeX
Jul 6 at 7:32
1
@naveganTeX This is a design choice. If anything one could replacetextbytextitforbookanduser, I think pure math mode would be "wrong". Writing answers is always a bit of a gamble, and my guess was that the one who produced the original screen shot used math mode only because they didn't know about the text command, but this may be a completely wrong guess.
– marmot
Jul 6 at 7:32
I would like to know if it is possible to draw a diagonal where it says “Ratings” and make it look like MoviesRatings?
– jassonpottersen
Jul 6 at 9:02
1
@jassonpottersen Yes, it is possible but if you aim at adding more features of that type you may be better off if you draw the matrix with TikZ. See here for a bunch of option.
– marmot
Jul 6 at 9:05
Mmm, it is throwing me an error. It does not work with blkarray, maybe just with tables?
– jassonpottersen
Jul 6 at 9:17
|
show 2 more comments
Welcome to TeX-SE! You already have everything, you only need to make minor adjustments of the layout, and change the contents of the cells.
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarraylccc
textRatings & textbook_1 & textbook_2 & textbook_3 \
beginblockl(ccc)
textuser_1 & - & 1 & - smash[b]vphantomBig\
textuser_2 & - & 5 & - \
textuser_3 & 4 & - & - \
textuser_4 & - & - & 2smash[t]vphantomBig\
endblock
endblockarray
]
enddocument

You could make the user and book texts italic (thanks to @naveganTeX for bringing this up!).
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarraylccc
textRatings & textitbook_1 & textitbook_2 & textitbook_3 \
beginblockl(ccc)
textituser_1 & - & 1 & - smash[b]vphantomBig\
textituser_2 & - & 5 & - \
textituser_3 & 4 & - & - \
textituser_4 & - & - & 2smash[t]vphantomBig\
endblock
endblockarray
]
enddocument

A very quickly written tikz version:
documentclassarticle
usepackageamsmath
usepackagetikz
usetikzlibrarymatrix,positioning
begindocument
begintikzpicture
matrix [matrix of math nodes,left delimiter=(,right delimiter=),
row sep=0.2em,column sep=2em] (m)
- & 1 & - \
- & 5 & - \
4 & - & - \
- & - & 2\;
foreach X in 1,...,4
node[anchor=east] (uX) at ([xshift=-1em]m.west
foreach X in 1,...,3
m-1-X)$textbook_X$;
draw ([yshift=0.3em]m.north west) -- ++ (-4em,1em);
node[anchor=south east] at ([yshift=0.02em]u1.north east) Ratings;
node[left=0.02em of b1,yshift=0.5em] Movies;
endtikzpicture
enddocument

Welcome to TeX-SE! You already have everything, you only need to make minor adjustments of the layout, and change the contents of the cells.
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarraylccc
textRatings & textbook_1 & textbook_2 & textbook_3 \
beginblockl(ccc)
textuser_1 & - & 1 & - smash[b]vphantomBig\
textuser_2 & - & 5 & - \
textuser_3 & 4 & - & - \
textuser_4 & - & - & 2smash[t]vphantomBig\
endblock
endblockarray
]
enddocument

You could make the user and book texts italic (thanks to @naveganTeX for bringing this up!).
documentclassarticle
usepackageamsmath,blkarray
begindocument
[
beginblockarraylccc
textRatings & textitbook_1 & textitbook_2 & textitbook_3 \
beginblockl(ccc)
textituser_1 & - & 1 & - smash[b]vphantomBig\
textituser_2 & - & 5 & - \
textituser_3 & 4 & - & - \
textituser_4 & - & - & 2smash[t]vphantomBig\
endblock
endblockarray
]
enddocument

A very quickly written tikz version:
documentclassarticle
usepackageamsmath
usepackagetikz
usetikzlibrarymatrix,positioning
begindocument
begintikzpicture
matrix [matrix of math nodes,left delimiter=(,right delimiter=),
row sep=0.2em,column sep=2em] (m)
- & 1 & - \
- & 5 & - \
4 & - & - \
- & - & 2\;
foreach X in 1,...,4
node[anchor=east] (uX) at ([xshift=-1em]m.west
foreach X in 1,...,3
m-1-X)$textbook_X$;
draw ([yshift=0.3em]m.north west) -- ++ (-4em,1em);
node[anchor=south east] at ([yshift=0.02em]u1.north east) Ratings;
node[left=0.02em of b1,yshift=0.5em] Movies;
endtikzpicture
enddocument

edited Jul 6 at 9:20
answered Jul 6 at 7:22
marmotmarmot
145k6 gold badges188 silver badges348 bronze badges
145k6 gold badges188 silver badges348 bronze badges
1
Great! I wanted to ask you if the words “user” and “book” aren’t in math mode?
– NaveganTeX
Jul 6 at 7:32
1
@naveganTeX This is a design choice. If anything one could replacetextbytextitforbookanduser, I think pure math mode would be "wrong". Writing answers is always a bit of a gamble, and my guess was that the one who produced the original screen shot used math mode only because they didn't know about the text command, but this may be a completely wrong guess.
– marmot
Jul 6 at 7:32
I would like to know if it is possible to draw a diagonal where it says “Ratings” and make it look like MoviesRatings?
– jassonpottersen
Jul 6 at 9:02
1
@jassonpottersen Yes, it is possible but if you aim at adding more features of that type you may be better off if you draw the matrix with TikZ. See here for a bunch of option.
– marmot
Jul 6 at 9:05
Mmm, it is throwing me an error. It does not work with blkarray, maybe just with tables?
– jassonpottersen
Jul 6 at 9:17
|
show 2 more comments
1
Great! I wanted to ask you if the words “user” and “book” aren’t in math mode?
– NaveganTeX
Jul 6 at 7:32
1
@naveganTeX This is a design choice. If anything one could replacetextbytextitforbookanduser, I think pure math mode would be "wrong". Writing answers is always a bit of a gamble, and my guess was that the one who produced the original screen shot used math mode only because they didn't know about the text command, but this may be a completely wrong guess.
– marmot
Jul 6 at 7:32
I would like to know if it is possible to draw a diagonal where it says “Ratings” and make it look like MoviesRatings?
– jassonpottersen
Jul 6 at 9:02
1
@jassonpottersen Yes, it is possible but if you aim at adding more features of that type you may be better off if you draw the matrix with TikZ. See here for a bunch of option.
– marmot
Jul 6 at 9:05
Mmm, it is throwing me an error. It does not work with blkarray, maybe just with tables?
– jassonpottersen
Jul 6 at 9:17
1
1
Great! I wanted to ask you if the words “user” and “book” aren’t in math mode?
– NaveganTeX
Jul 6 at 7:32
Great! I wanted to ask you if the words “user” and “book” aren’t in math mode?
– NaveganTeX
Jul 6 at 7:32
1
1
@naveganTeX This is a design choice. If anything one could replace
text by textit for book and user, I think pure math mode would be "wrong". Writing answers is always a bit of a gamble, and my guess was that the one who produced the original screen shot used math mode only because they didn't know about the text command, but this may be a completely wrong guess.– marmot
Jul 6 at 7:32
@naveganTeX This is a design choice. If anything one could replace
text by textit for book and user, I think pure math mode would be "wrong". Writing answers is always a bit of a gamble, and my guess was that the one who produced the original screen shot used math mode only because they didn't know about the text command, but this may be a completely wrong guess.– marmot
Jul 6 at 7:32
I would like to know if it is possible to draw a diagonal where it says “Ratings” and make it look like MoviesRatings?
– jassonpottersen
Jul 6 at 9:02
I would like to know if it is possible to draw a diagonal where it says “Ratings” and make it look like MoviesRatings?
– jassonpottersen
Jul 6 at 9:02
1
1
@jassonpottersen Yes, it is possible but if you aim at adding more features of that type you may be better off if you draw the matrix with TikZ. See here for a bunch of option.
– marmot
Jul 6 at 9:05
@jassonpottersen Yes, it is possible but if you aim at adding more features of that type you may be better off if you draw the matrix with TikZ. See here for a bunch of option.
– marmot
Jul 6 at 9:05
Mmm, it is throwing me an error. It does not work with blkarray, maybe just with tables?
– jassonpottersen
Jul 6 at 9:17
Mmm, it is throwing me an error. It does not work with blkarray, maybe just with tables?
– jassonpottersen
Jul 6 at 9:17
|
show 2 more comments
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%2f498840%2fdrawing-a-matrix%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