How to automatically compute space between the dots in hdotsfor
If you take a closer look at the included picture, you will notice the two vertical dotted lines are crooked and they are caused by the hdotsfor[6]{5} \ (see below MWE). So, is there a way to automatically compute the space between the dots generated by an hdotsfor in any size of a matrix to resolve such a crooked vertical dotted lines? Please note, the 5 units of cdots that form the horizontal dotted line above the hdotsfor[6]{5} \ line are there as a reference only to show what I want an hdotsfor to exactly generate the dots. 
documentclass{article}
usepackage{amsmath}
begin{document}
begin{equation*}
a_{1}
begin{vmatrix}
b_{2} &c_{2} &cdot &cdot &k_{2} \
b_{3} &c_{3} &cdot &cdot &k_{3} \
cdot &cdot &cdot &cdot &cdot \
hdotsfor[6]{5} \
b_{n} &c_{n} &cdot &cdot &k_{n}
end{vmatrix}
end{equation*}
end{document}
spacing matrices
add a comment |
If you take a closer look at the included picture, you will notice the two vertical dotted lines are crooked and they are caused by the hdotsfor[6]{5} \ (see below MWE). So, is there a way to automatically compute the space between the dots generated by an hdotsfor in any size of a matrix to resolve such a crooked vertical dotted lines? Please note, the 5 units of cdots that form the horizontal dotted line above the hdotsfor[6]{5} \ line are there as a reference only to show what I want an hdotsfor to exactly generate the dots. 
documentclass{article}
usepackage{amsmath}
begin{document}
begin{equation*}
a_{1}
begin{vmatrix}
b_{2} &c_{2} &cdot &cdot &k_{2} \
b_{3} &c_{3} &cdot &cdot &k_{3} \
cdot &cdot &cdot &cdot &cdot \
hdotsfor[6]{5} \
b_{n} &c_{n} &cdot &cdot &k_{n}
end{vmatrix}
end{equation*}
end{document}
spacing matrices
I don't think they'll ever line up withhdotsforin this way since the column widths are different. You'll have to create a macro to replicate$cdot$s...
– Werner
Jan 21 at 21:01
add a comment |
If you take a closer look at the included picture, you will notice the two vertical dotted lines are crooked and they are caused by the hdotsfor[6]{5} \ (see below MWE). So, is there a way to automatically compute the space between the dots generated by an hdotsfor in any size of a matrix to resolve such a crooked vertical dotted lines? Please note, the 5 units of cdots that form the horizontal dotted line above the hdotsfor[6]{5} \ line are there as a reference only to show what I want an hdotsfor to exactly generate the dots. 
documentclass{article}
usepackage{amsmath}
begin{document}
begin{equation*}
a_{1}
begin{vmatrix}
b_{2} &c_{2} &cdot &cdot &k_{2} \
b_{3} &c_{3} &cdot &cdot &k_{3} \
cdot &cdot &cdot &cdot &cdot \
hdotsfor[6]{5} \
b_{n} &c_{n} &cdot &cdot &k_{n}
end{vmatrix}
end{equation*}
end{document}
spacing matrices
If you take a closer look at the included picture, you will notice the two vertical dotted lines are crooked and they are caused by the hdotsfor[6]{5} \ (see below MWE). So, is there a way to automatically compute the space between the dots generated by an hdotsfor in any size of a matrix to resolve such a crooked vertical dotted lines? Please note, the 5 units of cdots that form the horizontal dotted line above the hdotsfor[6]{5} \ line are there as a reference only to show what I want an hdotsfor to exactly generate the dots. 
documentclass{article}
usepackage{amsmath}
begin{document}
begin{equation*}
a_{1}
begin{vmatrix}
b_{2} &c_{2} &cdot &cdot &k_{2} \
b_{3} &c_{3} &cdot &cdot &k_{3} \
cdot &cdot &cdot &cdot &cdot \
hdotsfor[6]{5} \
b_{n} &c_{n} &cdot &cdot &k_{n}
end{vmatrix}
end{equation*}
end{document}
spacing matrices
spacing matrices
edited Jan 22 at 0:50
Werner
442k679741669
442k679741669
asked Jan 21 at 20:52
user91822user91822
1425
1425
I don't think they'll ever line up withhdotsforin this way since the column widths are different. You'll have to create a macro to replicate$cdot$s...
– Werner
Jan 21 at 21:01
add a comment |
I don't think they'll ever line up withhdotsforin this way since the column widths are different. You'll have to create a macro to replicate$cdot$s...
– Werner
Jan 21 at 21:01
I don't think they'll ever line up with
hdotsfor in this way since the column widths are different. You'll have to create a macro to replicate $cdot$s...– Werner
Jan 21 at 21:01
I don't think they'll ever line up with
hdotsfor in this way since the column widths are different. You'll have to create a macro to replicate $cdot$s...– Werner
Jan 21 at 21:01
add a comment |
2 Answers
2
active
oldest
votes
The following is probably sufficient for your needs. It sets the first dot using multicolumn{1}{c}{cdot}, since multicolumn has to be the first (expanded) entry within a cell. Subsequent cdots are set as part of a replication of & multicolumn{1}{c}{cdot} over the remaining columns.

documentclass{article}
usepackage{amsmath,xfp}
ExplSyntaxOn
cs_new_eq:NN replicate prg_replicate:nn
ExplSyntaxOff
newcommand{cdotsfor}[1]{
multicolumn{1}{c}{cdot}% Place first dot
replicate{inteval{#1-1}}{& multicolumn{1}{c}{cdot}}% Place remaining dots
}
begin{document}
[
a_1
begin{vmatrix}
b_2 & c_2 & cdot & cdot & k_2 \
b_3 & c_3 & cdot & cdot & k_3 \
cdot & cdot & cdot & cdot & cdot \ % For reference
cdotsfor{5} \
b_n & c_n & cdot & cdot & k_n
end{vmatrix}
]
end{document}
Yes. It works as I wanted and thank you very much! Just for posterity sake (or perhaps I should create another topic), would it be possible for you to tailor your code to accommodate different width of any columns (if one column is wider), i.e. 1st column from (b_2 b_3 ... b_n)' changed to (alpha+b_2 beta+b_3 kappa+b_n)' that causes this column become much wider and to be filled with more dots and still be able to form the straight vertical dotted lines?
– user91822
Jan 22 at 12:13
@user91822: No. My solution just prints a number ofmulticolumn{1}{c}{cdot}s, so the dots will be spread out in the same manner the columns are, with onecdotper column.
– Werner
Jan 22 at 16:07
OK and I understood. Thank you.
– user91822
Jan 22 at 16:08
add a comment |
In general this is not possible as hdotsfor is a spanning cell like multicolumn (actually it is multicolumn) so it spans the specified number of columns with equally spaced dots. However the position of the single cdot entries in other rows depends on the width of the entries in the array information which is not readily available while constructing the spanning entry.
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/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%2f471199%2fhow-to-automatically-compute-space-between-the-dots-in-hdotsfor%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 is probably sufficient for your needs. It sets the first dot using multicolumn{1}{c}{cdot}, since multicolumn has to be the first (expanded) entry within a cell. Subsequent cdots are set as part of a replication of & multicolumn{1}{c}{cdot} over the remaining columns.

documentclass{article}
usepackage{amsmath,xfp}
ExplSyntaxOn
cs_new_eq:NN replicate prg_replicate:nn
ExplSyntaxOff
newcommand{cdotsfor}[1]{
multicolumn{1}{c}{cdot}% Place first dot
replicate{inteval{#1-1}}{& multicolumn{1}{c}{cdot}}% Place remaining dots
}
begin{document}
[
a_1
begin{vmatrix}
b_2 & c_2 & cdot & cdot & k_2 \
b_3 & c_3 & cdot & cdot & k_3 \
cdot & cdot & cdot & cdot & cdot \ % For reference
cdotsfor{5} \
b_n & c_n & cdot & cdot & k_n
end{vmatrix}
]
end{document}
Yes. It works as I wanted and thank you very much! Just for posterity sake (or perhaps I should create another topic), would it be possible for you to tailor your code to accommodate different width of any columns (if one column is wider), i.e. 1st column from (b_2 b_3 ... b_n)' changed to (alpha+b_2 beta+b_3 kappa+b_n)' that causes this column become much wider and to be filled with more dots and still be able to form the straight vertical dotted lines?
– user91822
Jan 22 at 12:13
@user91822: No. My solution just prints a number ofmulticolumn{1}{c}{cdot}s, so the dots will be spread out in the same manner the columns are, with onecdotper column.
– Werner
Jan 22 at 16:07
OK and I understood. Thank you.
– user91822
Jan 22 at 16:08
add a comment |
The following is probably sufficient for your needs. It sets the first dot using multicolumn{1}{c}{cdot}, since multicolumn has to be the first (expanded) entry within a cell. Subsequent cdots are set as part of a replication of & multicolumn{1}{c}{cdot} over the remaining columns.

documentclass{article}
usepackage{amsmath,xfp}
ExplSyntaxOn
cs_new_eq:NN replicate prg_replicate:nn
ExplSyntaxOff
newcommand{cdotsfor}[1]{
multicolumn{1}{c}{cdot}% Place first dot
replicate{inteval{#1-1}}{& multicolumn{1}{c}{cdot}}% Place remaining dots
}
begin{document}
[
a_1
begin{vmatrix}
b_2 & c_2 & cdot & cdot & k_2 \
b_3 & c_3 & cdot & cdot & k_3 \
cdot & cdot & cdot & cdot & cdot \ % For reference
cdotsfor{5} \
b_n & c_n & cdot & cdot & k_n
end{vmatrix}
]
end{document}
Yes. It works as I wanted and thank you very much! Just for posterity sake (or perhaps I should create another topic), would it be possible for you to tailor your code to accommodate different width of any columns (if one column is wider), i.e. 1st column from (b_2 b_3 ... b_n)' changed to (alpha+b_2 beta+b_3 kappa+b_n)' that causes this column become much wider and to be filled with more dots and still be able to form the straight vertical dotted lines?
– user91822
Jan 22 at 12:13
@user91822: No. My solution just prints a number ofmulticolumn{1}{c}{cdot}s, so the dots will be spread out in the same manner the columns are, with onecdotper column.
– Werner
Jan 22 at 16:07
OK and I understood. Thank you.
– user91822
Jan 22 at 16:08
add a comment |
The following is probably sufficient for your needs. It sets the first dot using multicolumn{1}{c}{cdot}, since multicolumn has to be the first (expanded) entry within a cell. Subsequent cdots are set as part of a replication of & multicolumn{1}{c}{cdot} over the remaining columns.

documentclass{article}
usepackage{amsmath,xfp}
ExplSyntaxOn
cs_new_eq:NN replicate prg_replicate:nn
ExplSyntaxOff
newcommand{cdotsfor}[1]{
multicolumn{1}{c}{cdot}% Place first dot
replicate{inteval{#1-1}}{& multicolumn{1}{c}{cdot}}% Place remaining dots
}
begin{document}
[
a_1
begin{vmatrix}
b_2 & c_2 & cdot & cdot & k_2 \
b_3 & c_3 & cdot & cdot & k_3 \
cdot & cdot & cdot & cdot & cdot \ % For reference
cdotsfor{5} \
b_n & c_n & cdot & cdot & k_n
end{vmatrix}
]
end{document}
The following is probably sufficient for your needs. It sets the first dot using multicolumn{1}{c}{cdot}, since multicolumn has to be the first (expanded) entry within a cell. Subsequent cdots are set as part of a replication of & multicolumn{1}{c}{cdot} over the remaining columns.

documentclass{article}
usepackage{amsmath,xfp}
ExplSyntaxOn
cs_new_eq:NN replicate prg_replicate:nn
ExplSyntaxOff
newcommand{cdotsfor}[1]{
multicolumn{1}{c}{cdot}% Place first dot
replicate{inteval{#1-1}}{& multicolumn{1}{c}{cdot}}% Place remaining dots
}
begin{document}
[
a_1
begin{vmatrix}
b_2 & c_2 & cdot & cdot & k_2 \
b_3 & c_3 & cdot & cdot & k_3 \
cdot & cdot & cdot & cdot & cdot \ % For reference
cdotsfor{5} \
b_n & c_n & cdot & cdot & k_n
end{vmatrix}
]
end{document}
answered Jan 22 at 0:49
WernerWerner
442k679741669
442k679741669
Yes. It works as I wanted and thank you very much! Just for posterity sake (or perhaps I should create another topic), would it be possible for you to tailor your code to accommodate different width of any columns (if one column is wider), i.e. 1st column from (b_2 b_3 ... b_n)' changed to (alpha+b_2 beta+b_3 kappa+b_n)' that causes this column become much wider and to be filled with more dots and still be able to form the straight vertical dotted lines?
– user91822
Jan 22 at 12:13
@user91822: No. My solution just prints a number ofmulticolumn{1}{c}{cdot}s, so the dots will be spread out in the same manner the columns are, with onecdotper column.
– Werner
Jan 22 at 16:07
OK and I understood. Thank you.
– user91822
Jan 22 at 16:08
add a comment |
Yes. It works as I wanted and thank you very much! Just for posterity sake (or perhaps I should create another topic), would it be possible for you to tailor your code to accommodate different width of any columns (if one column is wider), i.e. 1st column from (b_2 b_3 ... b_n)' changed to (alpha+b_2 beta+b_3 kappa+b_n)' that causes this column become much wider and to be filled with more dots and still be able to form the straight vertical dotted lines?
– user91822
Jan 22 at 12:13
@user91822: No. My solution just prints a number ofmulticolumn{1}{c}{cdot}s, so the dots will be spread out in the same manner the columns are, with onecdotper column.
– Werner
Jan 22 at 16:07
OK and I understood. Thank you.
– user91822
Jan 22 at 16:08
Yes. It works as I wanted and thank you very much! Just for posterity sake (or perhaps I should create another topic), would it be possible for you to tailor your code to accommodate different width of any columns (if one column is wider), i.e. 1st column from (b_2 b_3 ... b_n)' changed to (alpha+b_2 beta+b_3 kappa+b_n)' that causes this column become much wider and to be filled with more dots and still be able to form the straight vertical dotted lines?
– user91822
Jan 22 at 12:13
Yes. It works as I wanted and thank you very much! Just for posterity sake (or perhaps I should create another topic), would it be possible for you to tailor your code to accommodate different width of any columns (if one column is wider), i.e. 1st column from (b_2 b_3 ... b_n)' changed to (alpha+b_2 beta+b_3 kappa+b_n)' that causes this column become much wider and to be filled with more dots and still be able to form the straight vertical dotted lines?
– user91822
Jan 22 at 12:13
@user91822: No. My solution just prints a number of
multicolumn{1}{c}{cdot}s, so the dots will be spread out in the same manner the columns are, with one cdot per column.– Werner
Jan 22 at 16:07
@user91822: No. My solution just prints a number of
multicolumn{1}{c}{cdot}s, so the dots will be spread out in the same manner the columns are, with one cdot per column.– Werner
Jan 22 at 16:07
OK and I understood. Thank you.
– user91822
Jan 22 at 16:08
OK and I understood. Thank you.
– user91822
Jan 22 at 16:08
add a comment |
In general this is not possible as hdotsfor is a spanning cell like multicolumn (actually it is multicolumn) so it spans the specified number of columns with equally spaced dots. However the position of the single cdot entries in other rows depends on the width of the entries in the array information which is not readily available while constructing the spanning entry.
add a comment |
In general this is not possible as hdotsfor is a spanning cell like multicolumn (actually it is multicolumn) so it spans the specified number of columns with equally spaced dots. However the position of the single cdot entries in other rows depends on the width of the entries in the array information which is not readily available while constructing the spanning entry.
add a comment |
In general this is not possible as hdotsfor is a spanning cell like multicolumn (actually it is multicolumn) so it spans the specified number of columns with equally spaced dots. However the position of the single cdot entries in other rows depends on the width of the entries in the array information which is not readily available while constructing the spanning entry.
In general this is not possible as hdotsfor is a spanning cell like multicolumn (actually it is multicolumn) so it spans the specified number of columns with equally spaced dots. However the position of the single cdot entries in other rows depends on the width of the entries in the array information which is not readily available while constructing the spanning entry.
answered Jan 21 at 21:03
David CarlisleDavid Carlisle
487k4111271872
487k4111271872
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%2f471199%2fhow-to-automatically-compute-space-between-the-dots-in-hdotsfor%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
I don't think they'll ever line up with
hdotsforin this way since the column widths are different. You'll have to create a macro to replicate$cdot$s...– Werner
Jan 21 at 21:01