How to draw a nice diagonal matrix?diagonal line within matrixDiagonal text in diagonal matrixHow to create diagonal matrix with an aligned diagonal?Coloring the diagonal of a matrixHow to draw this special matrix with two diagonal braces?Draw a matrix partitioned into upper, lower, and diagonal partsHow to create the following diagonal matrix in Latex?How to draw a diagonal slash through an entire matrix in LaTeX?
Is the text of all UK treaties and laws public?
に vs. を in "to pass a test"
This fell out of my toilet when I unscrewed the supply line. What is it?
Was Wayne Brady considered a guest star on the original "Whose Line Is It Anyway?"
Why didn't Snape ask Dumbledore why he let "Moody" search his office?
Creating chess engine, machine learning vs. traditional engine?
Should I withdraw my paper because the Editor is behaving so badly with me?
In 1700s, why was 'books that never read' grammatical?
Does "Op. cit." stand for "opus citatum" or "opere citato"?
What are the bars protruding from this C-130?
Rat proofing compost bin but allowing worms in
How to handle motorists' dangerous behaviour with an impassable group?
one-liner vs script
How can I remove rest of file from string for all files?
Why did a young George Washington sign a document admitting to assassinating a French military officer?
How long could a human survive completely without the immune system?
Would we have more than 8 minutes of light, if the sun "went out"?
Can massive damage kill you while at 0 HP?
Iron-age tools, is there a way to extract heavy metals out of a creature?
Is there a magnetic attraction between two parallel electron beams?
Which accidental continues through the bar?
3x3 self-descriptive squares
My first random password generator
Can a Dragon enter the feywild at will?
How to draw a nice diagonal matrix?
diagonal line within matrixDiagonal text in diagonal matrixHow to create diagonal matrix with an aligned diagonal?Coloring the diagonal of a matrixHow to draw this special matrix with two diagonal braces?Draw a matrix partitioned into upper, lower, and diagonal partsHow to create the following diagonal matrix in Latex?How to draw a diagonal slash through an entire matrix in LaTeX?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
How to typeset a nice looking diagonal matrix? I find myself, once again, fiddling with phantoms and running raiseboxes to get an aesthetic result. This kind of micromanagement is bad practice, but why does the default look so bad and is there a better way?
documentclassarticle
usepackagemathtools
begindocument
beginalign*
operatornamediag x &=
beginbmatrix
x_1 & 0 & 0\
0 & ddots & 0 \
0 & 0 & x_n
endbmatrix
&
operatornamediag x &=
beginbmatrix
x_1 & 0 & 0\
0 & raisebox-0.4ex(ddots)rule[3.4ex]0pt0pt & 0 \
0 & 0 & x_n rule[3.4ex]0pt0pt
endbmatrix
endalign*
enddocument
matrices
add a comment
|
How to typeset a nice looking diagonal matrix? I find myself, once again, fiddling with phantoms and running raiseboxes to get an aesthetic result. This kind of micromanagement is bad practice, but why does the default look so bad and is there a better way?
documentclassarticle
usepackagemathtools
begindocument
beginalign*
operatornamediag x &=
beginbmatrix
x_1 & 0 & 0\
0 & ddots & 0 \
0 & 0 & x_n
endbmatrix
&
operatornamediag x &=
beginbmatrix
x_1 & 0 & 0\
0 & raisebox-0.4ex(ddots)rule[3.4ex]0pt0pt & 0 \
0 & 0 & x_n rule[3.4ex]0pt0pt
endbmatrix
endalign*
enddocument
matrices
First, useDeclareMathOperator
if you use "diag" many times in the document.
– user156344
Apr 17 at 11:34
1
Hmm, the problem is not withbmatrix
, but withddots
.
– user156344
Apr 17 at 11:39
defarraystretch1.5%
outside align or inside equation
– John Kormylo
Apr 17 at 15:17
add a comment
|
How to typeset a nice looking diagonal matrix? I find myself, once again, fiddling with phantoms and running raiseboxes to get an aesthetic result. This kind of micromanagement is bad practice, but why does the default look so bad and is there a better way?
documentclassarticle
usepackagemathtools
begindocument
beginalign*
operatornamediag x &=
beginbmatrix
x_1 & 0 & 0\
0 & ddots & 0 \
0 & 0 & x_n
endbmatrix
&
operatornamediag x &=
beginbmatrix
x_1 & 0 & 0\
0 & raisebox-0.4ex(ddots)rule[3.4ex]0pt0pt & 0 \
0 & 0 & x_n rule[3.4ex]0pt0pt
endbmatrix
endalign*
enddocument
matrices
How to typeset a nice looking diagonal matrix? I find myself, once again, fiddling with phantoms and running raiseboxes to get an aesthetic result. This kind of micromanagement is bad practice, but why does the default look so bad and is there a better way?
documentclassarticle
usepackagemathtools
begindocument
beginalign*
operatornamediag x &=
beginbmatrix
x_1 & 0 & 0\
0 & ddots & 0 \
0 & 0 & x_n
endbmatrix
&
operatornamediag x &=
beginbmatrix
x_1 & 0 & 0\
0 & raisebox-0.4ex(ddots)rule[3.4ex]0pt0pt & 0 \
0 & 0 & x_n rule[3.4ex]0pt0pt
endbmatrix
endalign*
enddocument
matrices
matrices
asked Apr 17 at 11:33
MankkaMankka
2522 silver badges9 bronze badges
2522 silver badges9 bronze badges
First, useDeclareMathOperator
if you use "diag" many times in the document.
– user156344
Apr 17 at 11:34
1
Hmm, the problem is not withbmatrix
, but withddots
.
– user156344
Apr 17 at 11:39
defarraystretch1.5%
outside align or inside equation
– John Kormylo
Apr 17 at 15:17
add a comment
|
First, useDeclareMathOperator
if you use "diag" many times in the document.
– user156344
Apr 17 at 11:34
1
Hmm, the problem is not withbmatrix
, but withddots
.
– user156344
Apr 17 at 11:39
defarraystretch1.5%
outside align or inside equation
– John Kormylo
Apr 17 at 15:17
First, use
DeclareMathOperator
if you use "diag" many times in the document.– user156344
Apr 17 at 11:34
First, use
DeclareMathOperator
if you use "diag" many times in the document.– user156344
Apr 17 at 11:34
1
1
Hmm, the problem is not with
bmatrix
, but with ddots
.– user156344
Apr 17 at 11:39
Hmm, the problem is not with
bmatrix
, but with ddots
.– user156344
Apr 17 at 11:39
defarraystretch1.5%
outside align or inside equation– John Kormylo
Apr 17 at 15:17
defarraystretch1.5%
outside align or inside equation– John Kormylo
Apr 17 at 15:17
add a comment
|
2 Answers
2
active
oldest
votes
A TABstack alternative.
documentclassarticle
usepackagemathtools,tabstackengine
TABstackMath% STACK MATRIX IN MATH MODE
setstacktabbedgap10pt% INTER-COLUMN GAP SIZE
setstackgapL1.5baselineskip% INTER-ROW BASELINESKIP
newcommandcddotsraisebox-1pt$ddots$
begindocument
[ operatornamediag x =
bracketMatrixstack
x_1 & 0 & 0\
0 & cddots & 0 \
0 & 0 & x_n
]
enddocument
While not needed for diagonal matrices of the type portrayed by the OP, the package has a fixTABwidth<T or F>
declaration to fix all column widths to the largest found in the matrix. That can be helpful if there are wide matrix entries:
documentclassarticle
usepackagemathtools,tabstackengine
TABstackMath% STACK MATRIX IN MATH MODE
setstacktabbedgap10pt% INTER-COLUMN GAP SIZE
setstackgapL1.5baselineskip% INTER-ROW BASELINESKIP
newcommandcddotsraisebox-1pt$ddots$
begindocument
fixTABwidthT
[ operatornamediag x =
bracketMatrixstack
x_1 & 0 & 12345\
0 & cddots & 0 \
0 & 0 & x_n
]
enddocument
add a comment
|
You could if you liked to use the package nicematrix
. Between the many options defined by nicematrix
there is columns-width, where you can fit the two brackets of the matrix in function of the values into it.
documentclassarticle
usepackagemathtools
usepackagenicematrix
NiceMatrixOptionstransparent,nullify-dots
begindocument
[operatornamediag x =beginbmatrix[columns-width = 3mm]
x_1 & 0 & 0\
0 & ddots & 0 \
0 & 0 & x_n
endbmatrix]
enddocument
Another possibility using columns-width = auto
:
documentclassarticle
usepackagemathtools
usepackagenicematrix
NiceMatrixOptionstransparent,nullify-dots
begindocument
[operatornamediag x =beginbmatrix[columns-width = auto]
x_1 & 436436 & 67676\
0 & ddots & 0 \
8778 & 0 & x_n
endbmatrix]
enddocument
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%2f485276%2fhow-to-draw-a-nice-diagonal-matrix%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
A TABstack alternative.
documentclassarticle
usepackagemathtools,tabstackengine
TABstackMath% STACK MATRIX IN MATH MODE
setstacktabbedgap10pt% INTER-COLUMN GAP SIZE
setstackgapL1.5baselineskip% INTER-ROW BASELINESKIP
newcommandcddotsraisebox-1pt$ddots$
begindocument
[ operatornamediag x =
bracketMatrixstack
x_1 & 0 & 0\
0 & cddots & 0 \
0 & 0 & x_n
]
enddocument
While not needed for diagonal matrices of the type portrayed by the OP, the package has a fixTABwidth<T or F>
declaration to fix all column widths to the largest found in the matrix. That can be helpful if there are wide matrix entries:
documentclassarticle
usepackagemathtools,tabstackengine
TABstackMath% STACK MATRIX IN MATH MODE
setstacktabbedgap10pt% INTER-COLUMN GAP SIZE
setstackgapL1.5baselineskip% INTER-ROW BASELINESKIP
newcommandcddotsraisebox-1pt$ddots$
begindocument
fixTABwidthT
[ operatornamediag x =
bracketMatrixstack
x_1 & 0 & 12345\
0 & cddots & 0 \
0 & 0 & x_n
]
enddocument
add a comment
|
A TABstack alternative.
documentclassarticle
usepackagemathtools,tabstackengine
TABstackMath% STACK MATRIX IN MATH MODE
setstacktabbedgap10pt% INTER-COLUMN GAP SIZE
setstackgapL1.5baselineskip% INTER-ROW BASELINESKIP
newcommandcddotsraisebox-1pt$ddots$
begindocument
[ operatornamediag x =
bracketMatrixstack
x_1 & 0 & 0\
0 & cddots & 0 \
0 & 0 & x_n
]
enddocument
While not needed for diagonal matrices of the type portrayed by the OP, the package has a fixTABwidth<T or F>
declaration to fix all column widths to the largest found in the matrix. That can be helpful if there are wide matrix entries:
documentclassarticle
usepackagemathtools,tabstackengine
TABstackMath% STACK MATRIX IN MATH MODE
setstacktabbedgap10pt% INTER-COLUMN GAP SIZE
setstackgapL1.5baselineskip% INTER-ROW BASELINESKIP
newcommandcddotsraisebox-1pt$ddots$
begindocument
fixTABwidthT
[ operatornamediag x =
bracketMatrixstack
x_1 & 0 & 12345\
0 & cddots & 0 \
0 & 0 & x_n
]
enddocument
add a comment
|
A TABstack alternative.
documentclassarticle
usepackagemathtools,tabstackengine
TABstackMath% STACK MATRIX IN MATH MODE
setstacktabbedgap10pt% INTER-COLUMN GAP SIZE
setstackgapL1.5baselineskip% INTER-ROW BASELINESKIP
newcommandcddotsraisebox-1pt$ddots$
begindocument
[ operatornamediag x =
bracketMatrixstack
x_1 & 0 & 0\
0 & cddots & 0 \
0 & 0 & x_n
]
enddocument
While not needed for diagonal matrices of the type portrayed by the OP, the package has a fixTABwidth<T or F>
declaration to fix all column widths to the largest found in the matrix. That can be helpful if there are wide matrix entries:
documentclassarticle
usepackagemathtools,tabstackengine
TABstackMath% STACK MATRIX IN MATH MODE
setstacktabbedgap10pt% INTER-COLUMN GAP SIZE
setstackgapL1.5baselineskip% INTER-ROW BASELINESKIP
newcommandcddotsraisebox-1pt$ddots$
begindocument
fixTABwidthT
[ operatornamediag x =
bracketMatrixstack
x_1 & 0 & 12345\
0 & cddots & 0 \
0 & 0 & x_n
]
enddocument
A TABstack alternative.
documentclassarticle
usepackagemathtools,tabstackengine
TABstackMath% STACK MATRIX IN MATH MODE
setstacktabbedgap10pt% INTER-COLUMN GAP SIZE
setstackgapL1.5baselineskip% INTER-ROW BASELINESKIP
newcommandcddotsraisebox-1pt$ddots$
begindocument
[ operatornamediag x =
bracketMatrixstack
x_1 & 0 & 0\
0 & cddots & 0 \
0 & 0 & x_n
]
enddocument
While not needed for diagonal matrices of the type portrayed by the OP, the package has a fixTABwidth<T or F>
declaration to fix all column widths to the largest found in the matrix. That can be helpful if there are wide matrix entries:
documentclassarticle
usepackagemathtools,tabstackengine
TABstackMath% STACK MATRIX IN MATH MODE
setstacktabbedgap10pt% INTER-COLUMN GAP SIZE
setstackgapL1.5baselineskip% INTER-ROW BASELINESKIP
newcommandcddotsraisebox-1pt$ddots$
begindocument
fixTABwidthT
[ operatornamediag x =
bracketMatrixstack
x_1 & 0 & 12345\
0 & cddots & 0 \
0 & 0 & x_n
]
enddocument
answered Apr 17 at 11:55
Steven B. SegletesSteven B. Segletes
171k9 gold badges216 silver badges444 bronze badges
171k9 gold badges216 silver badges444 bronze badges
add a comment
|
add a comment
|
You could if you liked to use the package nicematrix
. Between the many options defined by nicematrix
there is columns-width, where you can fit the two brackets of the matrix in function of the values into it.
documentclassarticle
usepackagemathtools
usepackagenicematrix
NiceMatrixOptionstransparent,nullify-dots
begindocument
[operatornamediag x =beginbmatrix[columns-width = 3mm]
x_1 & 0 & 0\
0 & ddots & 0 \
0 & 0 & x_n
endbmatrix]
enddocument
Another possibility using columns-width = auto
:
documentclassarticle
usepackagemathtools
usepackagenicematrix
NiceMatrixOptionstransparent,nullify-dots
begindocument
[operatornamediag x =beginbmatrix[columns-width = auto]
x_1 & 436436 & 67676\
0 & ddots & 0 \
8778 & 0 & x_n
endbmatrix]
enddocument
add a comment
|
You could if you liked to use the package nicematrix
. Between the many options defined by nicematrix
there is columns-width, where you can fit the two brackets of the matrix in function of the values into it.
documentclassarticle
usepackagemathtools
usepackagenicematrix
NiceMatrixOptionstransparent,nullify-dots
begindocument
[operatornamediag x =beginbmatrix[columns-width = 3mm]
x_1 & 0 & 0\
0 & ddots & 0 \
0 & 0 & x_n
endbmatrix]
enddocument
Another possibility using columns-width = auto
:
documentclassarticle
usepackagemathtools
usepackagenicematrix
NiceMatrixOptionstransparent,nullify-dots
begindocument
[operatornamediag x =beginbmatrix[columns-width = auto]
x_1 & 436436 & 67676\
0 & ddots & 0 \
8778 & 0 & x_n
endbmatrix]
enddocument
add a comment
|
You could if you liked to use the package nicematrix
. Between the many options defined by nicematrix
there is columns-width, where you can fit the two brackets of the matrix in function of the values into it.
documentclassarticle
usepackagemathtools
usepackagenicematrix
NiceMatrixOptionstransparent,nullify-dots
begindocument
[operatornamediag x =beginbmatrix[columns-width = 3mm]
x_1 & 0 & 0\
0 & ddots & 0 \
0 & 0 & x_n
endbmatrix]
enddocument
Another possibility using columns-width = auto
:
documentclassarticle
usepackagemathtools
usepackagenicematrix
NiceMatrixOptionstransparent,nullify-dots
begindocument
[operatornamediag x =beginbmatrix[columns-width = auto]
x_1 & 436436 & 67676\
0 & ddots & 0 \
8778 & 0 & x_n
endbmatrix]
enddocument
You could if you liked to use the package nicematrix
. Between the many options defined by nicematrix
there is columns-width, where you can fit the two brackets of the matrix in function of the values into it.
documentclassarticle
usepackagemathtools
usepackagenicematrix
NiceMatrixOptionstransparent,nullify-dots
begindocument
[operatornamediag x =beginbmatrix[columns-width = 3mm]
x_1 & 0 & 0\
0 & ddots & 0 \
0 & 0 & x_n
endbmatrix]
enddocument
Another possibility using columns-width = auto
:
documentclassarticle
usepackagemathtools
usepackagenicematrix
NiceMatrixOptionstransparent,nullify-dots
begindocument
[operatornamediag x =beginbmatrix[columns-width = auto]
x_1 & 436436 & 67676\
0 & ddots & 0 \
8778 & 0 & x_n
endbmatrix]
enddocument
answered May 2 at 8:41
SebastianoSebastiano
16.4k5 gold badges27 silver badges82 bronze badges
16.4k5 gold badges27 silver badges82 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%2f485276%2fhow-to-draw-a-nice-diagonal-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
First, use
DeclareMathOperator
if you use "diag" many times in the document.– user156344
Apr 17 at 11:34
1
Hmm, the problem is not with
bmatrix
, but withddots
.– user156344
Apr 17 at 11:39
defarraystretch1.5%
outside align or inside equation– John Kormylo
Apr 17 at 15:17