Know in which column am I in [on hold]












2















it there a way to have a variable that returns in which column of my multicols environment am I in?
Thanks!










share|improve this question













put on hold as unclear what you're asking by Kurt, Stefan Pinnow, TeXnician, Werner, Phelype Oleinik 2 days ago


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 4





    Can you add a bit of context for what you need to know the column number?

    – samcarter
    2 days ago











  • See tex.stackexchange.com/a/414638/117050 there I wrote some code to get the current column inside of a ToC.

    – Skillmon
    2 days ago











  • Possible duplicate of Detecting current column in multicol

    – Werner
    2 days ago
















2















it there a way to have a variable that returns in which column of my multicols environment am I in?
Thanks!










share|improve this question













put on hold as unclear what you're asking by Kurt, Stefan Pinnow, TeXnician, Werner, Phelype Oleinik 2 days ago


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 4





    Can you add a bit of context for what you need to know the column number?

    – samcarter
    2 days ago











  • See tex.stackexchange.com/a/414638/117050 there I wrote some code to get the current column inside of a ToC.

    – Skillmon
    2 days ago











  • Possible duplicate of Detecting current column in multicol

    – Werner
    2 days ago














2












2








2


1






it there a way to have a variable that returns in which column of my multicols environment am I in?
Thanks!










share|improve this question














it there a way to have a variable that returns in which column of my multicols environment am I in?
Thanks!







multicol programming






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 2 days ago









Lord NexprexLord Nexprex

1145




1145




put on hold as unclear what you're asking by Kurt, Stefan Pinnow, TeXnician, Werner, Phelype Oleinik 2 days ago


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









put on hold as unclear what you're asking by Kurt, Stefan Pinnow, TeXnician, Werner, Phelype Oleinik 2 days ago


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 4





    Can you add a bit of context for what you need to know the column number?

    – samcarter
    2 days ago











  • See tex.stackexchange.com/a/414638/117050 there I wrote some code to get the current column inside of a ToC.

    – Skillmon
    2 days ago











  • Possible duplicate of Detecting current column in multicol

    – Werner
    2 days ago














  • 4





    Can you add a bit of context for what you need to know the column number?

    – samcarter
    2 days ago











  • See tex.stackexchange.com/a/414638/117050 there I wrote some code to get the current column inside of a ToC.

    – Skillmon
    2 days ago











  • Possible duplicate of Detecting current column in multicol

    – Werner
    2 days ago








4




4





Can you add a bit of context for what you need to know the column number?

– samcarter
2 days ago





Can you add a bit of context for what you need to know the column number?

– samcarter
2 days ago













See tex.stackexchange.com/a/414638/117050 there I wrote some code to get the current column inside of a ToC.

– Skillmon
2 days ago





See tex.stackexchange.com/a/414638/117050 there I wrote some code to get the current column inside of a ToC.

– Skillmon
2 days ago













Possible duplicate of Detecting current column in multicol

– Werner
2 days ago





Possible duplicate of Detecting current column in multicol

– Werner
2 days ago










2 Answers
2






active

oldest

votes


















5














Out of the box multicol supports finding out if you are at a certain point in the first, the last or one of the middle columns (assuming you have more than 2 columns). That is done using docolaction which is described in the documentation (and needs to be explicitly enabled via an option). If you need more detail then perhaps the link suggested above provides that, but by default multicol distinguishes ones the 3 cases.






share|improve this answer































    5














    The following yields the current column unexpandably. It needs at least 2 runs of LaTeX.



    documentclass{article}

    usepackage[left=2mm,right=2mm]{geometry}
    usepackage[colaction]{multicol}
    usepackage{etoolbox}

    makeatletter
    newcounter{nexprex@col@count}
    newcounter{nexprex@current@column@call}
    defnexprex@patch@last
    {%
    stepcounter{nexprex@col@count}%
    protected@write@auxout{}
    {%
    stringdefstringnexprex@cur@col{arabic{nexprex@col@count}}%
    }%
    }
    defnexprex@patch@else
    {%
    ifmc@firstcol
    setcounter{nexprex@col@count}{0}%
    fi
    nexprex@patch@last
    }
    defnexprex@patch@error
    {%
    GenericError{}
    {Patching of stringmc@col@status@writespace failed}
    {%
    Make sure `colaction` was set as an option for `multicol`.%
    MessageBreak
    Else you're screwed, don't use the code provided here.MessageBreak%
    }
    {No further help available.}%
    }
    pretocmdmc@lastcol@status@write{nexprex@patch@last}{}{nexprex@patch@error}
    pretocmdmc@col@status@write{nexprex@patch@else}{}{nexprex@patch@error}
    newcommandcurrentcolumn
    {%
    stepcounter{nexprex@current@column@call}%
    protected@write@auxout{}
    {%
    stringexpandafter
    stringglobal
    stringexpandafter
    stringlet
    stringcsnamespace
    nexprex@current@column@arabic{nexprex@current@column@call}%
    stringendcsname
    stringnexprex@cur@col
    }%
    ifcsname
    nexprex@current@column@arabic{nexprex@current@column@call}endcsname
    csname
    nexprex@current@column@arabic{nexprex@current@column@call}endcsname
    fi
    }
    makeatother


    begin{document}
    begin{multicols}{5}
    noindent
    This is: currentcolumn
    columnbreak\
    This is: currentcolumn
    columnbreak\
    This is: currentcolumn
    columnbreak\
    This is: currentcolumn
    columnbreak\
    This is: currentcolumn
    end{multicols}
    end{document}





    share|improve this answer
























    • Well done! Why we need at least 2 runs of LaTeX? Why should this happen?

      – manooooh
      2 days ago






    • 1





      @manooooh because the code I inject into mc@lastcol@status@write and mc@col@status@write is executed at ship out time and the counter isn't yet increased. Therefore we move the definitions of the current columns into the aux file.

      – Skillmon
      2 days ago


















    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    Out of the box multicol supports finding out if you are at a certain point in the first, the last or one of the middle columns (assuming you have more than 2 columns). That is done using docolaction which is described in the documentation (and needs to be explicitly enabled via an option). If you need more detail then perhaps the link suggested above provides that, but by default multicol distinguishes ones the 3 cases.






    share|improve this answer




























      5














      Out of the box multicol supports finding out if you are at a certain point in the first, the last or one of the middle columns (assuming you have more than 2 columns). That is done using docolaction which is described in the documentation (and needs to be explicitly enabled via an option). If you need more detail then perhaps the link suggested above provides that, but by default multicol distinguishes ones the 3 cases.






      share|improve this answer


























        5












        5








        5







        Out of the box multicol supports finding out if you are at a certain point in the first, the last or one of the middle columns (assuming you have more than 2 columns). That is done using docolaction which is described in the documentation (and needs to be explicitly enabled via an option). If you need more detail then perhaps the link suggested above provides that, but by default multicol distinguishes ones the 3 cases.






        share|improve this answer













        Out of the box multicol supports finding out if you are at a certain point in the first, the last or one of the middle columns (assuming you have more than 2 columns). That is done using docolaction which is described in the documentation (and needs to be explicitly enabled via an option). If you need more detail then perhaps the link suggested above provides that, but by default multicol distinguishes ones the 3 cases.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 days ago









        Frank MittelbachFrank Mittelbach

        60.7k6178248




        60.7k6178248























            5














            The following yields the current column unexpandably. It needs at least 2 runs of LaTeX.



            documentclass{article}

            usepackage[left=2mm,right=2mm]{geometry}
            usepackage[colaction]{multicol}
            usepackage{etoolbox}

            makeatletter
            newcounter{nexprex@col@count}
            newcounter{nexprex@current@column@call}
            defnexprex@patch@last
            {%
            stepcounter{nexprex@col@count}%
            protected@write@auxout{}
            {%
            stringdefstringnexprex@cur@col{arabic{nexprex@col@count}}%
            }%
            }
            defnexprex@patch@else
            {%
            ifmc@firstcol
            setcounter{nexprex@col@count}{0}%
            fi
            nexprex@patch@last
            }
            defnexprex@patch@error
            {%
            GenericError{}
            {Patching of stringmc@col@status@writespace failed}
            {%
            Make sure `colaction` was set as an option for `multicol`.%
            MessageBreak
            Else you're screwed, don't use the code provided here.MessageBreak%
            }
            {No further help available.}%
            }
            pretocmdmc@lastcol@status@write{nexprex@patch@last}{}{nexprex@patch@error}
            pretocmdmc@col@status@write{nexprex@patch@else}{}{nexprex@patch@error}
            newcommandcurrentcolumn
            {%
            stepcounter{nexprex@current@column@call}%
            protected@write@auxout{}
            {%
            stringexpandafter
            stringglobal
            stringexpandafter
            stringlet
            stringcsnamespace
            nexprex@current@column@arabic{nexprex@current@column@call}%
            stringendcsname
            stringnexprex@cur@col
            }%
            ifcsname
            nexprex@current@column@arabic{nexprex@current@column@call}endcsname
            csname
            nexprex@current@column@arabic{nexprex@current@column@call}endcsname
            fi
            }
            makeatother


            begin{document}
            begin{multicols}{5}
            noindent
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            end{multicols}
            end{document}





            share|improve this answer
























            • Well done! Why we need at least 2 runs of LaTeX? Why should this happen?

              – manooooh
              2 days ago






            • 1





              @manooooh because the code I inject into mc@lastcol@status@write and mc@col@status@write is executed at ship out time and the counter isn't yet increased. Therefore we move the definitions of the current columns into the aux file.

              – Skillmon
              2 days ago
















            5














            The following yields the current column unexpandably. It needs at least 2 runs of LaTeX.



            documentclass{article}

            usepackage[left=2mm,right=2mm]{geometry}
            usepackage[colaction]{multicol}
            usepackage{etoolbox}

            makeatletter
            newcounter{nexprex@col@count}
            newcounter{nexprex@current@column@call}
            defnexprex@patch@last
            {%
            stepcounter{nexprex@col@count}%
            protected@write@auxout{}
            {%
            stringdefstringnexprex@cur@col{arabic{nexprex@col@count}}%
            }%
            }
            defnexprex@patch@else
            {%
            ifmc@firstcol
            setcounter{nexprex@col@count}{0}%
            fi
            nexprex@patch@last
            }
            defnexprex@patch@error
            {%
            GenericError{}
            {Patching of stringmc@col@status@writespace failed}
            {%
            Make sure `colaction` was set as an option for `multicol`.%
            MessageBreak
            Else you're screwed, don't use the code provided here.MessageBreak%
            }
            {No further help available.}%
            }
            pretocmdmc@lastcol@status@write{nexprex@patch@last}{}{nexprex@patch@error}
            pretocmdmc@col@status@write{nexprex@patch@else}{}{nexprex@patch@error}
            newcommandcurrentcolumn
            {%
            stepcounter{nexprex@current@column@call}%
            protected@write@auxout{}
            {%
            stringexpandafter
            stringglobal
            stringexpandafter
            stringlet
            stringcsnamespace
            nexprex@current@column@arabic{nexprex@current@column@call}%
            stringendcsname
            stringnexprex@cur@col
            }%
            ifcsname
            nexprex@current@column@arabic{nexprex@current@column@call}endcsname
            csname
            nexprex@current@column@arabic{nexprex@current@column@call}endcsname
            fi
            }
            makeatother


            begin{document}
            begin{multicols}{5}
            noindent
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            end{multicols}
            end{document}





            share|improve this answer
























            • Well done! Why we need at least 2 runs of LaTeX? Why should this happen?

              – manooooh
              2 days ago






            • 1





              @manooooh because the code I inject into mc@lastcol@status@write and mc@col@status@write is executed at ship out time and the counter isn't yet increased. Therefore we move the definitions of the current columns into the aux file.

              – Skillmon
              2 days ago














            5












            5








            5







            The following yields the current column unexpandably. It needs at least 2 runs of LaTeX.



            documentclass{article}

            usepackage[left=2mm,right=2mm]{geometry}
            usepackage[colaction]{multicol}
            usepackage{etoolbox}

            makeatletter
            newcounter{nexprex@col@count}
            newcounter{nexprex@current@column@call}
            defnexprex@patch@last
            {%
            stepcounter{nexprex@col@count}%
            protected@write@auxout{}
            {%
            stringdefstringnexprex@cur@col{arabic{nexprex@col@count}}%
            }%
            }
            defnexprex@patch@else
            {%
            ifmc@firstcol
            setcounter{nexprex@col@count}{0}%
            fi
            nexprex@patch@last
            }
            defnexprex@patch@error
            {%
            GenericError{}
            {Patching of stringmc@col@status@writespace failed}
            {%
            Make sure `colaction` was set as an option for `multicol`.%
            MessageBreak
            Else you're screwed, don't use the code provided here.MessageBreak%
            }
            {No further help available.}%
            }
            pretocmdmc@lastcol@status@write{nexprex@patch@last}{}{nexprex@patch@error}
            pretocmdmc@col@status@write{nexprex@patch@else}{}{nexprex@patch@error}
            newcommandcurrentcolumn
            {%
            stepcounter{nexprex@current@column@call}%
            protected@write@auxout{}
            {%
            stringexpandafter
            stringglobal
            stringexpandafter
            stringlet
            stringcsnamespace
            nexprex@current@column@arabic{nexprex@current@column@call}%
            stringendcsname
            stringnexprex@cur@col
            }%
            ifcsname
            nexprex@current@column@arabic{nexprex@current@column@call}endcsname
            csname
            nexprex@current@column@arabic{nexprex@current@column@call}endcsname
            fi
            }
            makeatother


            begin{document}
            begin{multicols}{5}
            noindent
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            end{multicols}
            end{document}





            share|improve this answer













            The following yields the current column unexpandably. It needs at least 2 runs of LaTeX.



            documentclass{article}

            usepackage[left=2mm,right=2mm]{geometry}
            usepackage[colaction]{multicol}
            usepackage{etoolbox}

            makeatletter
            newcounter{nexprex@col@count}
            newcounter{nexprex@current@column@call}
            defnexprex@patch@last
            {%
            stepcounter{nexprex@col@count}%
            protected@write@auxout{}
            {%
            stringdefstringnexprex@cur@col{arabic{nexprex@col@count}}%
            }%
            }
            defnexprex@patch@else
            {%
            ifmc@firstcol
            setcounter{nexprex@col@count}{0}%
            fi
            nexprex@patch@last
            }
            defnexprex@patch@error
            {%
            GenericError{}
            {Patching of stringmc@col@status@writespace failed}
            {%
            Make sure `colaction` was set as an option for `multicol`.%
            MessageBreak
            Else you're screwed, don't use the code provided here.MessageBreak%
            }
            {No further help available.}%
            }
            pretocmdmc@lastcol@status@write{nexprex@patch@last}{}{nexprex@patch@error}
            pretocmdmc@col@status@write{nexprex@patch@else}{}{nexprex@patch@error}
            newcommandcurrentcolumn
            {%
            stepcounter{nexprex@current@column@call}%
            protected@write@auxout{}
            {%
            stringexpandafter
            stringglobal
            stringexpandafter
            stringlet
            stringcsnamespace
            nexprex@current@column@arabic{nexprex@current@column@call}%
            stringendcsname
            stringnexprex@cur@col
            }%
            ifcsname
            nexprex@current@column@arabic{nexprex@current@column@call}endcsname
            csname
            nexprex@current@column@arabic{nexprex@current@column@call}endcsname
            fi
            }
            makeatother


            begin{document}
            begin{multicols}{5}
            noindent
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            columnbreak\
            This is: currentcolumn
            end{multicols}
            end{document}






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 2 days ago









            SkillmonSkillmon

            21.8k11942




            21.8k11942













            • Well done! Why we need at least 2 runs of LaTeX? Why should this happen?

              – manooooh
              2 days ago






            • 1





              @manooooh because the code I inject into mc@lastcol@status@write and mc@col@status@write is executed at ship out time and the counter isn't yet increased. Therefore we move the definitions of the current columns into the aux file.

              – Skillmon
              2 days ago



















            • Well done! Why we need at least 2 runs of LaTeX? Why should this happen?

              – manooooh
              2 days ago






            • 1





              @manooooh because the code I inject into mc@lastcol@status@write and mc@col@status@write is executed at ship out time and the counter isn't yet increased. Therefore we move the definitions of the current columns into the aux file.

              – Skillmon
              2 days ago

















            Well done! Why we need at least 2 runs of LaTeX? Why should this happen?

            – manooooh
            2 days ago





            Well done! Why we need at least 2 runs of LaTeX? Why should this happen?

            – manooooh
            2 days ago




            1




            1





            @manooooh because the code I inject into mc@lastcol@status@write and mc@col@status@write is executed at ship out time and the counter isn't yet increased. Therefore we move the definitions of the current columns into the aux file.

            – Skillmon
            2 days ago





            @manooooh because the code I inject into mc@lastcol@status@write and mc@col@status@write is executed at ship out time and the counter isn't yet increased. Therefore we move the definitions of the current columns into the aux file.

            – Skillmon
            2 days ago



            Popular posts from this blog

            Paul Cézanne

            UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

            Angular material date-picker (MatDatepicker) auto completes the date on focus out