How to stretch table or minipage to fill remaining space?

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I am trying to make a document like this:



enter image description here



Since there's quite a lot of such sections, I want to make a new command like textwithline so I can then type



Author: textwithlineJoe ShmoeFirst name, Last name

This author's editor: textwithlineBilly WillyFirst name, Last name


in my document.



Note the important features:



  • The line must fill all available remaining space

  • The text above and below the line must be centered on the line

  • The text on the left is variable length (or may be blank)

What is a good way of making such a command? I have tried:




  • tabular with hfill but it doesn't actually stretch the table


  • tabular* but it doesn't "give room" to the text on the left


  • minipage but that requires me to hard code width every time


  • ulinehfill Billy Willy hfillhfill First name, Last name hfill with centering but then text below line is not centered on the line, but on the page






share|improve this question




















  • Related: How to calculate width of remaining part of line
    – Werner
    Aug 8 at 19:58














up vote
3
down vote

favorite












I am trying to make a document like this:



enter image description here



Since there's quite a lot of such sections, I want to make a new command like textwithline so I can then type



Author: textwithlineJoe ShmoeFirst name, Last name

This author's editor: textwithlineBilly WillyFirst name, Last name


in my document.



Note the important features:



  • The line must fill all available remaining space

  • The text above and below the line must be centered on the line

  • The text on the left is variable length (or may be blank)

What is a good way of making such a command? I have tried:




  • tabular with hfill but it doesn't actually stretch the table


  • tabular* but it doesn't "give room" to the text on the left


  • minipage but that requires me to hard code width every time


  • ulinehfill Billy Willy hfillhfill First name, Last name hfill with centering but then text below line is not centered on the line, but on the page






share|improve this question




















  • Related: How to calculate width of remaining part of line
    – Werner
    Aug 8 at 19:58












up vote
3
down vote

favorite









up vote
3
down vote

favorite











I am trying to make a document like this:



enter image description here



Since there's quite a lot of such sections, I want to make a new command like textwithline so I can then type



Author: textwithlineJoe ShmoeFirst name, Last name

This author's editor: textwithlineBilly WillyFirst name, Last name


in my document.



Note the important features:



  • The line must fill all available remaining space

  • The text above and below the line must be centered on the line

  • The text on the left is variable length (or may be blank)

What is a good way of making such a command? I have tried:




  • tabular with hfill but it doesn't actually stretch the table


  • tabular* but it doesn't "give room" to the text on the left


  • minipage but that requires me to hard code width every time


  • ulinehfill Billy Willy hfillhfill First name, Last name hfill with centering but then text below line is not centered on the line, but on the page






share|improve this question












I am trying to make a document like this:



enter image description here



Since there's quite a lot of such sections, I want to make a new command like textwithline so I can then type



Author: textwithlineJoe ShmoeFirst name, Last name

This author's editor: textwithlineBilly WillyFirst name, Last name


in my document.



Note the important features:



  • The line must fill all available remaining space

  • The text above and below the line must be centered on the line

  • The text on the left is variable length (or may be blank)

What is a good way of making such a command? I have tried:




  • tabular with hfill but it doesn't actually stretch the table


  • tabular* but it doesn't "give room" to the text on the left


  • minipage but that requires me to hard code width every time


  • ulinehfill Billy Willy hfillhfill First name, Last name hfill with centering but then text below line is not centered on the line, but on the page








share|improve this question











share|improve this question




share|improve this question










asked Aug 8 at 19:40









Imsong

161




161











  • Related: How to calculate width of remaining part of line
    – Werner
    Aug 8 at 19:58
















  • Related: How to calculate width of remaining part of line
    – Werner
    Aug 8 at 19:58















Related: How to calculate width of remaining part of line
– Werner
Aug 8 at 19:58




Related: How to calculate width of remaining part of line
– Werner
Aug 8 at 19:58










2 Answers
2






active

oldest

votes

















up vote
6
down vote













enter image description here



documentclassarticle

newcommandtextwithline[2]%
setlengthparfillskip0pt%
hrulefill
raisebox5ptmakebox[0pt]#1%
raisebox-12ptmakebox[0pt]#2%
hrulefill
par
bigskip

begindocument



Author: textwithlineJoe ShmoeFirst name, Last name

This author's editor: textwithlineBilly WillyFirst name, Last name

enddocument





share|improve this answer



























    up vote
    3
    down vote













    Here is an option using linegoal to calculate the remaining width of the line (given by linegoal).



    enter image description here



    documentclassarticle

    usepackagelinegoal

    newcommandtextwithline[2]%
    beginminipage[t]linegoal
    centeringstrut #1 \[-.7baselineskip]
    hrulefill \[-.1baselineskip]
    centeringsmallfootnotesize #2
    endminipagepar
    addvspace.5baselineskip


    begindocument

    Author: textwithlineJoe ShmoeFirst name, Last name

    This author's editor: textwithlineBilly WillyFirst name, Last name

    enddocument


    Since linegoal uses a label-ref-like system (thanks to zref), any changes in width would require you to compile at least twice before the width settles.






    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',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      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%2f445211%2fhow-to-stretch-table-or-minipage-to-fill-remaining-space%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      6
      down vote













      enter image description here



      documentclassarticle

      newcommandtextwithline[2]%
      setlengthparfillskip0pt%
      hrulefill
      raisebox5ptmakebox[0pt]#1%
      raisebox-12ptmakebox[0pt]#2%
      hrulefill
      par
      bigskip

      begindocument



      Author: textwithlineJoe ShmoeFirst name, Last name

      This author's editor: textwithlineBilly WillyFirst name, Last name

      enddocument





      share|improve this answer
























        up vote
        6
        down vote













        enter image description here



        documentclassarticle

        newcommandtextwithline[2]%
        setlengthparfillskip0pt%
        hrulefill
        raisebox5ptmakebox[0pt]#1%
        raisebox-12ptmakebox[0pt]#2%
        hrulefill
        par
        bigskip

        begindocument



        Author: textwithlineJoe ShmoeFirst name, Last name

        This author's editor: textwithlineBilly WillyFirst name, Last name

        enddocument





        share|improve this answer






















          up vote
          6
          down vote










          up vote
          6
          down vote









          enter image description here



          documentclassarticle

          newcommandtextwithline[2]%
          setlengthparfillskip0pt%
          hrulefill
          raisebox5ptmakebox[0pt]#1%
          raisebox-12ptmakebox[0pt]#2%
          hrulefill
          par
          bigskip

          begindocument



          Author: textwithlineJoe ShmoeFirst name, Last name

          This author's editor: textwithlineBilly WillyFirst name, Last name

          enddocument





          share|improve this answer












          enter image description here



          documentclassarticle

          newcommandtextwithline[2]%
          setlengthparfillskip0pt%
          hrulefill
          raisebox5ptmakebox[0pt]#1%
          raisebox-12ptmakebox[0pt]#2%
          hrulefill
          par
          bigskip

          begindocument



          Author: textwithlineJoe ShmoeFirst name, Last name

          This author's editor: textwithlineBilly WillyFirst name, Last name

          enddocument






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 8 at 20:04









          David Carlisle

          462k3810851803




          462k3810851803




















              up vote
              3
              down vote













              Here is an option using linegoal to calculate the remaining width of the line (given by linegoal).



              enter image description here



              documentclassarticle

              usepackagelinegoal

              newcommandtextwithline[2]%
              beginminipage[t]linegoal
              centeringstrut #1 \[-.7baselineskip]
              hrulefill \[-.1baselineskip]
              centeringsmallfootnotesize #2
              endminipagepar
              addvspace.5baselineskip


              begindocument

              Author: textwithlineJoe ShmoeFirst name, Last name

              This author's editor: textwithlineBilly WillyFirst name, Last name

              enddocument


              Since linegoal uses a label-ref-like system (thanks to zref), any changes in width would require you to compile at least twice before the width settles.






              share|improve this answer
























                up vote
                3
                down vote













                Here is an option using linegoal to calculate the remaining width of the line (given by linegoal).



                enter image description here



                documentclassarticle

                usepackagelinegoal

                newcommandtextwithline[2]%
                beginminipage[t]linegoal
                centeringstrut #1 \[-.7baselineskip]
                hrulefill \[-.1baselineskip]
                centeringsmallfootnotesize #2
                endminipagepar
                addvspace.5baselineskip


                begindocument

                Author: textwithlineJoe ShmoeFirst name, Last name

                This author's editor: textwithlineBilly WillyFirst name, Last name

                enddocument


                Since linegoal uses a label-ref-like system (thanks to zref), any changes in width would require you to compile at least twice before the width settles.






                share|improve this answer






















                  up vote
                  3
                  down vote










                  up vote
                  3
                  down vote









                  Here is an option using linegoal to calculate the remaining width of the line (given by linegoal).



                  enter image description here



                  documentclassarticle

                  usepackagelinegoal

                  newcommandtextwithline[2]%
                  beginminipage[t]linegoal
                  centeringstrut #1 \[-.7baselineskip]
                  hrulefill \[-.1baselineskip]
                  centeringsmallfootnotesize #2
                  endminipagepar
                  addvspace.5baselineskip


                  begindocument

                  Author: textwithlineJoe ShmoeFirst name, Last name

                  This author's editor: textwithlineBilly WillyFirst name, Last name

                  enddocument


                  Since linegoal uses a label-ref-like system (thanks to zref), any changes in width would require you to compile at least twice before the width settles.






                  share|improve this answer












                  Here is an option using linegoal to calculate the remaining width of the line (given by linegoal).



                  enter image description here



                  documentclassarticle

                  usepackagelinegoal

                  newcommandtextwithline[2]%
                  beginminipage[t]linegoal
                  centeringstrut #1 \[-.7baselineskip]
                  hrulefill \[-.1baselineskip]
                  centeringsmallfootnotesize #2
                  endminipagepar
                  addvspace.5baselineskip


                  begindocument

                  Author: textwithlineJoe ShmoeFirst name, Last name

                  This author's editor: textwithlineBilly WillyFirst name, Last name

                  enddocument


                  Since linegoal uses a label-ref-like system (thanks to zref), any changes in width would require you to compile at least twice before the width settles.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 8 at 19:56









                  Werner

                  418k579081572




                  418k579081572






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f445211%2fhow-to-stretch-table-or-minipage-to-fill-remaining-space%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      L8X,QwLrFSne0
                      Zb,FYAx8yfeezI hjR,MDTmX4QmSd782HTYYUTHXBD2AHWI6VwavzNY,LyO9gvkVwr3 W jPpKmh,JJrueRmcsUanmC1qyglG,to

                      這個網誌中的熱門文章

                      How to combine Bézier curves to a surface?

                      Propositional logic and tautologies

                      Distribution of Stopped Wiener Process with Stochastic Volatility