How to automatically compute space between the dots in hdotsfor












1















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. enter image description here



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}









share|improve this question

























  • 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
















1















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. enter image description here



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}









share|improve this question

























  • 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














1












1








1








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. enter image description here



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}









share|improve this question
















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. enter image description here



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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

















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










2 Answers
2






active

oldest

votes


















2














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.



enter image description here



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}





share|improve this answer
























  • 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











  • OK and I understood. Thank you.

    – user91822
    Jan 22 at 16:08



















1














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.






share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    2














    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.



    enter image description here



    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}





    share|improve this answer
























    • 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











    • OK and I understood. Thank you.

      – user91822
      Jan 22 at 16:08
















    2














    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.



    enter image description here



    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}





    share|improve this answer
























    • 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











    • OK and I understood. Thank you.

      – user91822
      Jan 22 at 16:08














    2












    2








    2







    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.



    enter image description here



    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}





    share|improve this answer













    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.



    enter image description here



    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}






    share|improve this answer












    share|improve this answer



    share|improve this answer










    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 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



















    • 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











    • 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











    1














    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.






    share|improve this answer




























      1














      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.






      share|improve this answer


























        1












        1








        1







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 21 at 21:03









        David CarlisleDavid Carlisle

        487k4111271872




        487k4111271872






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            How to send String Array data to Server using php in android

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Is anime1.com a legal site for watching anime?