Best way to vertically align leftwordgroup with top of wordbox or bitbox Announcing the...

How to align text above triangle figure

Output the ŋarâþ crîþ alphabet song without using (m)any letters

Why do we bend a book to keep it straight?

Apollo command module space walk?

Dating a Former Employee

How to answer "Have you ever been terminated?"

Why is "Consequences inflicted." not a sentence?

Should I use a zero-interest credit card for a large one-time purchase?

Should I discuss the type of campaign with my players?

How to deal with a team lead who never gives me credit?

How widely used is the term Treppenwitz? Is it something that most Germans know?

What is the role of the transistor and diode in a soft start circuit?

Can a non-EU citizen traveling with me come with me through the EU passport line?

How does the particle を relate to the verb 行く in the structure「A を + B に行く」?

Why aren't air breathing engines used as small first stages

How to find all the available tools in macOS terminal?

Can an alien society believe that their star system is the universe?

What is a non-alternating simple group with big order, but relatively few conjugacy classes?

Do I really need recursive chmod to restrict access to a folder?

Storing hydrofluoric acid before the invention of plastics

Why am I getting the error "non-boolean type specified in a context where a condition is expected" for this request?

How discoverable are IPv6 addresses and AAAA names by potential attackers?

Denied boarding although I have proper visa and documentation. To whom should I make a complaint?

ListPlot join points by nearest neighbor rather than order



Best way to vertically align leftwordgroup with top of wordbox or bitbox



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How to define a function with undefined number of arguments to draw bytefield with variable number of bitbox?Bytefields: horizontally align leftwordgroupBytefield colors and baseline alignBytefield - Help with big datagram












4















This code



documentclass{article}
usepackage{bytefield}

begin{document}
begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
begin{leftwordgroup}{0}
wordbox{1}{theheight}
end{leftwordgroup} \
begin{leftwordgroup}{raisebox{totalheight}4}
wordbox{2}{theheight}
end{leftwordgroup} \
begin{leftwordgroup}{raisebox{6ex}{12}}
wordbox{2}{theheight}
end{leftwordgroup}
end{bytefield}
end{document}


results in



enter image description here



I'd like to get the 0 and the 4 left word groups to be vertically aligned with the top of their corresponding wordboxes. However, the only way I've found to do that is to trial and error it with raisebox{6ex}. height and totalheight seem to refer to the height of the text in the group. leftwordgroup doesn't make height available the same way wordbox and bitbox does.



Is there a more precise way to specify the vertical alignment of the left wordgroup?



Update



Thanks for taking the time to help me out with this.



When this was applied to a more sophisticated use of bytefield, it's a bit off.



documentclass{standalone}
usepackage{bytefield}
usepackage{stackengine}
newcommandtopwg[2]{%
makebox[3ex][l]{makebox[2ex][r]{tiny{#1}}}belowbaseline[-.3htstrutbox]{#2}
}

begin{document}
begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
bitheader{0,8,16,24} \
topwg{0}{begin{leftwordgroup}{}
begin{rightwordgroup}{Standard Header}
wordbox{1}{theheight}
end{rightwordgroup}
end{leftwordgroup}} \
topwg{4}{begin{leftwordgroup}{}
wordbox{2}{theheight}
end{leftwordgroup}} \
topwg{12}{begin{leftwordgroup}{}
wordbox{2}{theheight}
end{leftwordgroup}}
end{bytefield}
end{document}


enter image description here



Again, thanks a lot for your help.










share|improve this question

























  • Joe, you needed to leave a comment on my answer in order for me to know that you had seen my answer. Nonetheless, I've seen your update now. But I don't understand what's a bit "off". Could you be more specific? You can comment on your own question, but if you want me to be notified, you have to include the phrase "@Steven B. Segletes" somewhere in your comment.

    – Steven B. Segletes
    Jan 15 '14 at 19:29











  • @Steven B. Segletes: thanks for the advice on commenting. Referring to the second image in the question, the "Standard Header" right word group is a bit high, and there are gaps between the word boxes, when the -.3 modifier is specified. I worked out how to keep the bitheader from being shifted to the left.

    – Joe Doyle
    Jan 15 '14 at 20:28











  • Please see my revised answer.

    – Steven B. Segletes
    Jan 16 '14 at 1:12
















4















This code



documentclass{article}
usepackage{bytefield}

begin{document}
begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
begin{leftwordgroup}{0}
wordbox{1}{theheight}
end{leftwordgroup} \
begin{leftwordgroup}{raisebox{totalheight}4}
wordbox{2}{theheight}
end{leftwordgroup} \
begin{leftwordgroup}{raisebox{6ex}{12}}
wordbox{2}{theheight}
end{leftwordgroup}
end{bytefield}
end{document}


results in



enter image description here



I'd like to get the 0 and the 4 left word groups to be vertically aligned with the top of their corresponding wordboxes. However, the only way I've found to do that is to trial and error it with raisebox{6ex}. height and totalheight seem to refer to the height of the text in the group. leftwordgroup doesn't make height available the same way wordbox and bitbox does.



Is there a more precise way to specify the vertical alignment of the left wordgroup?



Update



Thanks for taking the time to help me out with this.



When this was applied to a more sophisticated use of bytefield, it's a bit off.



documentclass{standalone}
usepackage{bytefield}
usepackage{stackengine}
newcommandtopwg[2]{%
makebox[3ex][l]{makebox[2ex][r]{tiny{#1}}}belowbaseline[-.3htstrutbox]{#2}
}

begin{document}
begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
bitheader{0,8,16,24} \
topwg{0}{begin{leftwordgroup}{}
begin{rightwordgroup}{Standard Header}
wordbox{1}{theheight}
end{rightwordgroup}
end{leftwordgroup}} \
topwg{4}{begin{leftwordgroup}{}
wordbox{2}{theheight}
end{leftwordgroup}} \
topwg{12}{begin{leftwordgroup}{}
wordbox{2}{theheight}
end{leftwordgroup}}
end{bytefield}
end{document}


enter image description here



Again, thanks a lot for your help.










share|improve this question

























  • Joe, you needed to leave a comment on my answer in order for me to know that you had seen my answer. Nonetheless, I've seen your update now. But I don't understand what's a bit "off". Could you be more specific? You can comment on your own question, but if you want me to be notified, you have to include the phrase "@Steven B. Segletes" somewhere in your comment.

    – Steven B. Segletes
    Jan 15 '14 at 19:29











  • @Steven B. Segletes: thanks for the advice on commenting. Referring to the second image in the question, the "Standard Header" right word group is a bit high, and there are gaps between the word boxes, when the -.3 modifier is specified. I worked out how to keep the bitheader from being shifted to the left.

    – Joe Doyle
    Jan 15 '14 at 20:28











  • Please see my revised answer.

    – Steven B. Segletes
    Jan 16 '14 at 1:12














4












4








4








This code



documentclass{article}
usepackage{bytefield}

begin{document}
begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
begin{leftwordgroup}{0}
wordbox{1}{theheight}
end{leftwordgroup} \
begin{leftwordgroup}{raisebox{totalheight}4}
wordbox{2}{theheight}
end{leftwordgroup} \
begin{leftwordgroup}{raisebox{6ex}{12}}
wordbox{2}{theheight}
end{leftwordgroup}
end{bytefield}
end{document}


results in



enter image description here



I'd like to get the 0 and the 4 left word groups to be vertically aligned with the top of their corresponding wordboxes. However, the only way I've found to do that is to trial and error it with raisebox{6ex}. height and totalheight seem to refer to the height of the text in the group. leftwordgroup doesn't make height available the same way wordbox and bitbox does.



Is there a more precise way to specify the vertical alignment of the left wordgroup?



Update



Thanks for taking the time to help me out with this.



When this was applied to a more sophisticated use of bytefield, it's a bit off.



documentclass{standalone}
usepackage{bytefield}
usepackage{stackengine}
newcommandtopwg[2]{%
makebox[3ex][l]{makebox[2ex][r]{tiny{#1}}}belowbaseline[-.3htstrutbox]{#2}
}

begin{document}
begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
bitheader{0,8,16,24} \
topwg{0}{begin{leftwordgroup}{}
begin{rightwordgroup}{Standard Header}
wordbox{1}{theheight}
end{rightwordgroup}
end{leftwordgroup}} \
topwg{4}{begin{leftwordgroup}{}
wordbox{2}{theheight}
end{leftwordgroup}} \
topwg{12}{begin{leftwordgroup}{}
wordbox{2}{theheight}
end{leftwordgroup}}
end{bytefield}
end{document}


enter image description here



Again, thanks a lot for your help.










share|improve this question
















This code



documentclass{article}
usepackage{bytefield}

begin{document}
begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
begin{leftwordgroup}{0}
wordbox{1}{theheight}
end{leftwordgroup} \
begin{leftwordgroup}{raisebox{totalheight}4}
wordbox{2}{theheight}
end{leftwordgroup} \
begin{leftwordgroup}{raisebox{6ex}{12}}
wordbox{2}{theheight}
end{leftwordgroup}
end{bytefield}
end{document}


results in



enter image description here



I'd like to get the 0 and the 4 left word groups to be vertically aligned with the top of their corresponding wordboxes. However, the only way I've found to do that is to trial and error it with raisebox{6ex}. height and totalheight seem to refer to the height of the text in the group. leftwordgroup doesn't make height available the same way wordbox and bitbox does.



Is there a more precise way to specify the vertical alignment of the left wordgroup?



Update



Thanks for taking the time to help me out with this.



When this was applied to a more sophisticated use of bytefield, it's a bit off.



documentclass{standalone}
usepackage{bytefield}
usepackage{stackengine}
newcommandtopwg[2]{%
makebox[3ex][l]{makebox[2ex][r]{tiny{#1}}}belowbaseline[-.3htstrutbox]{#2}
}

begin{document}
begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
bitheader{0,8,16,24} \
topwg{0}{begin{leftwordgroup}{}
begin{rightwordgroup}{Standard Header}
wordbox{1}{theheight}
end{rightwordgroup}
end{leftwordgroup}} \
topwg{4}{begin{leftwordgroup}{}
wordbox{2}{theheight}
end{leftwordgroup}} \
topwg{12}{begin{leftwordgroup}{}
wordbox{2}{theheight}
end{leftwordgroup}}
end{bytefield}
end{document}


enter image description here



Again, thanks a lot for your help.







bytefield






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 15 '14 at 16:27







Joe Doyle

















asked Jan 15 '14 at 15:04









Joe DoyleJoe Doyle

234




234













  • Joe, you needed to leave a comment on my answer in order for me to know that you had seen my answer. Nonetheless, I've seen your update now. But I don't understand what's a bit "off". Could you be more specific? You can comment on your own question, but if you want me to be notified, you have to include the phrase "@Steven B. Segletes" somewhere in your comment.

    – Steven B. Segletes
    Jan 15 '14 at 19:29











  • @Steven B. Segletes: thanks for the advice on commenting. Referring to the second image in the question, the "Standard Header" right word group is a bit high, and there are gaps between the word boxes, when the -.3 modifier is specified. I worked out how to keep the bitheader from being shifted to the left.

    – Joe Doyle
    Jan 15 '14 at 20:28











  • Please see my revised answer.

    – Steven B. Segletes
    Jan 16 '14 at 1:12



















  • Joe, you needed to leave a comment on my answer in order for me to know that you had seen my answer. Nonetheless, I've seen your update now. But I don't understand what's a bit "off". Could you be more specific? You can comment on your own question, but if you want me to be notified, you have to include the phrase "@Steven B. Segletes" somewhere in your comment.

    – Steven B. Segletes
    Jan 15 '14 at 19:29











  • @Steven B. Segletes: thanks for the advice on commenting. Referring to the second image in the question, the "Standard Header" right word group is a bit high, and there are gaps between the word boxes, when the -.3 modifier is specified. I worked out how to keep the bitheader from being shifted to the left.

    – Joe Doyle
    Jan 15 '14 at 20:28











  • Please see my revised answer.

    – Steven B. Segletes
    Jan 16 '14 at 1:12

















Joe, you needed to leave a comment on my answer in order for me to know that you had seen my answer. Nonetheless, I've seen your update now. But I don't understand what's a bit "off". Could you be more specific? You can comment on your own question, but if you want me to be notified, you have to include the phrase "@Steven B. Segletes" somewhere in your comment.

– Steven B. Segletes
Jan 15 '14 at 19:29





Joe, you needed to leave a comment on my answer in order for me to know that you had seen my answer. Nonetheless, I've seen your update now. But I don't understand what's a bit "off". Could you be more specific? You can comment on your own question, but if you want me to be notified, you have to include the phrase "@Steven B. Segletes" somewhere in your comment.

– Steven B. Segletes
Jan 15 '14 at 19:29













@Steven B. Segletes: thanks for the advice on commenting. Referring to the second image in the question, the "Standard Header" right word group is a bit high, and there are gaps between the word boxes, when the -.3 modifier is specified. I worked out how to keep the bitheader from being shifted to the left.

– Joe Doyle
Jan 15 '14 at 20:28





@Steven B. Segletes: thanks for the advice on commenting. Referring to the second image in the question, the "Standard Header" right word group is a bit high, and there are gaps between the word boxes, when the -.3 modifier is specified. I worked out how to keep the bitheader from being shifted to the left.

– Joe Doyle
Jan 15 '14 at 20:28













Please see my revised answer.

– Steven B. Segletes
Jan 16 '14 at 1:12





Please see my revised answer.

– Steven B. Segletes
Jan 16 '14 at 1:12










1 Answer
1






active

oldest

votes


















3














Here, I introduce topwg macro that takes two arguments. The first is the label that would otherwise go as the first argument to leftwordgroup, and the second is the leftwordgroup environment with a blank first argument.



What this does is vertically shift the word group so that, instead of having its baseline aligned with the central text, it instead places the top of the wordgroup box at the height of a strutbox.



EDITED to address some deficiencies noted by the OP. I believe the inter-box gap was caused by some glue introduced by boxes that were located at fractional baseline height. Thus, I restored the htstrutbox shift of belowbaseline and tuned the left-label relative to that with a raisebox. This also corrected the problem with the vertical position of the right-hand label. Additionally, I added a small negative vspace at the end of topwg to avoid a double-thick rule between boxes.



documentclass{article}
usepackage{bytefield}
usepackage{stackengine}
newcommandtopwg[2]{%
raisebox{.7htstrutbox}{makebox[3ex][l]{makebox[2ex][r]{%
tiny{#1}}}}belowbaseline[-htstrutbox]{#2}vspace{-.65pt}%
}
%renewcommandtopwg[2]{#2}
begin{document}
begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
bitheader{0,8,16,24} \
topwg{0}{begin{leftwordgroup}{}
begin{rightwordgroup}{Standard Header}
wordbox{1}{theheight}
end{rightwordgroup}
end{leftwordgroup}} \
topwg{4}{begin{leftwordgroup}{}
wordbox{2}{theheight}
end{leftwordgroup}} \
topwg{12}{begin{leftwordgroup}{}
wordbox{2}{theheight}
end{leftwordgroup}}
end{bytefield}
end{document}


enter image description here



If you plan on having more than two digits in the label to the left of the box, you can expand the width of the two makeboxes defined in topwg. The first number (3ex) determines the width of the labels on the left while the second number (2ex) specifies the left padding for those labels.



To change the height of the left-label, change the amount of the raisebox at the beginning of topwg.



I also changed the documentclass to article rather than standalone to prevent the bottom rule from being clipped (I'm not sure why).






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%2f154219%2fbest-way-to-vertically-align-leftwordgroup-with-top-of-wordbox-or-bitbox%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    Here, I introduce topwg macro that takes two arguments. The first is the label that would otherwise go as the first argument to leftwordgroup, and the second is the leftwordgroup environment with a blank first argument.



    What this does is vertically shift the word group so that, instead of having its baseline aligned with the central text, it instead places the top of the wordgroup box at the height of a strutbox.



    EDITED to address some deficiencies noted by the OP. I believe the inter-box gap was caused by some glue introduced by boxes that were located at fractional baseline height. Thus, I restored the htstrutbox shift of belowbaseline and tuned the left-label relative to that with a raisebox. This also corrected the problem with the vertical position of the right-hand label. Additionally, I added a small negative vspace at the end of topwg to avoid a double-thick rule between boxes.



    documentclass{article}
    usepackage{bytefield}
    usepackage{stackengine}
    newcommandtopwg[2]{%
    raisebox{.7htstrutbox}{makebox[3ex][l]{makebox[2ex][r]{%
    tiny{#1}}}}belowbaseline[-htstrutbox]{#2}vspace{-.65pt}%
    }
    %renewcommandtopwg[2]{#2}
    begin{document}
    begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
    bitheader{0,8,16,24} \
    topwg{0}{begin{leftwordgroup}{}
    begin{rightwordgroup}{Standard Header}
    wordbox{1}{theheight}
    end{rightwordgroup}
    end{leftwordgroup}} \
    topwg{4}{begin{leftwordgroup}{}
    wordbox{2}{theheight}
    end{leftwordgroup}} \
    topwg{12}{begin{leftwordgroup}{}
    wordbox{2}{theheight}
    end{leftwordgroup}}
    end{bytefield}
    end{document}


    enter image description here



    If you plan on having more than two digits in the label to the left of the box, you can expand the width of the two makeboxes defined in topwg. The first number (3ex) determines the width of the labels on the left while the second number (2ex) specifies the left padding for those labels.



    To change the height of the left-label, change the amount of the raisebox at the beginning of topwg.



    I also changed the documentclass to article rather than standalone to prevent the bottom rule from being clipped (I'm not sure why).






    share|improve this answer






























      3














      Here, I introduce topwg macro that takes two arguments. The first is the label that would otherwise go as the first argument to leftwordgroup, and the second is the leftwordgroup environment with a blank first argument.



      What this does is vertically shift the word group so that, instead of having its baseline aligned with the central text, it instead places the top of the wordgroup box at the height of a strutbox.



      EDITED to address some deficiencies noted by the OP. I believe the inter-box gap was caused by some glue introduced by boxes that were located at fractional baseline height. Thus, I restored the htstrutbox shift of belowbaseline and tuned the left-label relative to that with a raisebox. This also corrected the problem with the vertical position of the right-hand label. Additionally, I added a small negative vspace at the end of topwg to avoid a double-thick rule between boxes.



      documentclass{article}
      usepackage{bytefield}
      usepackage{stackengine}
      newcommandtopwg[2]{%
      raisebox{.7htstrutbox}{makebox[3ex][l]{makebox[2ex][r]{%
      tiny{#1}}}}belowbaseline[-htstrutbox]{#2}vspace{-.65pt}%
      }
      %renewcommandtopwg[2]{#2}
      begin{document}
      begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
      bitheader{0,8,16,24} \
      topwg{0}{begin{leftwordgroup}{}
      begin{rightwordgroup}{Standard Header}
      wordbox{1}{theheight}
      end{rightwordgroup}
      end{leftwordgroup}} \
      topwg{4}{begin{leftwordgroup}{}
      wordbox{2}{theheight}
      end{leftwordgroup}} \
      topwg{12}{begin{leftwordgroup}{}
      wordbox{2}{theheight}
      end{leftwordgroup}}
      end{bytefield}
      end{document}


      enter image description here



      If you plan on having more than two digits in the label to the left of the box, you can expand the width of the two makeboxes defined in topwg. The first number (3ex) determines the width of the labels on the left while the second number (2ex) specifies the left padding for those labels.



      To change the height of the left-label, change the amount of the raisebox at the beginning of topwg.



      I also changed the documentclass to article rather than standalone to prevent the bottom rule from being clipped (I'm not sure why).






      share|improve this answer




























        3












        3








        3







        Here, I introduce topwg macro that takes two arguments. The first is the label that would otherwise go as the first argument to leftwordgroup, and the second is the leftwordgroup environment with a blank first argument.



        What this does is vertically shift the word group so that, instead of having its baseline aligned with the central text, it instead places the top of the wordgroup box at the height of a strutbox.



        EDITED to address some deficiencies noted by the OP. I believe the inter-box gap was caused by some glue introduced by boxes that were located at fractional baseline height. Thus, I restored the htstrutbox shift of belowbaseline and tuned the left-label relative to that with a raisebox. This also corrected the problem with the vertical position of the right-hand label. Additionally, I added a small negative vspace at the end of topwg to avoid a double-thick rule between boxes.



        documentclass{article}
        usepackage{bytefield}
        usepackage{stackengine}
        newcommandtopwg[2]{%
        raisebox{.7htstrutbox}{makebox[3ex][l]{makebox[2ex][r]{%
        tiny{#1}}}}belowbaseline[-htstrutbox]{#2}vspace{-.65pt}%
        }
        %renewcommandtopwg[2]{#2}
        begin{document}
        begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
        bitheader{0,8,16,24} \
        topwg{0}{begin{leftwordgroup}{}
        begin{rightwordgroup}{Standard Header}
        wordbox{1}{theheight}
        end{rightwordgroup}
        end{leftwordgroup}} \
        topwg{4}{begin{leftwordgroup}{}
        wordbox{2}{theheight}
        end{leftwordgroup}} \
        topwg{12}{begin{leftwordgroup}{}
        wordbox{2}{theheight}
        end{leftwordgroup}}
        end{bytefield}
        end{document}


        enter image description here



        If you plan on having more than two digits in the label to the left of the box, you can expand the width of the two makeboxes defined in topwg. The first number (3ex) determines the width of the labels on the left while the second number (2ex) specifies the left padding for those labels.



        To change the height of the left-label, change the amount of the raisebox at the beginning of topwg.



        I also changed the documentclass to article rather than standalone to prevent the bottom rule from being clipped (I'm not sure why).






        share|improve this answer















        Here, I introduce topwg macro that takes two arguments. The first is the label that would otherwise go as the first argument to leftwordgroup, and the second is the leftwordgroup environment with a blank first argument.



        What this does is vertically shift the word group so that, instead of having its baseline aligned with the central text, it instead places the top of the wordgroup box at the height of a strutbox.



        EDITED to address some deficiencies noted by the OP. I believe the inter-box gap was caused by some glue introduced by boxes that were located at fractional baseline height. Thus, I restored the htstrutbox shift of belowbaseline and tuned the left-label relative to that with a raisebox. This also corrected the problem with the vertical position of the right-hand label. Additionally, I added a small negative vspace at the end of topwg to avoid a double-thick rule between boxes.



        documentclass{article}
        usepackage{bytefield}
        usepackage{stackengine}
        newcommandtopwg[2]{%
        raisebox{.7htstrutbox}{makebox[3ex][l]{makebox[2ex][r]{%
        tiny{#1}}}}belowbaseline[-htstrutbox]{#2}vspace{-.65pt}%
        }
        %renewcommandtopwg[2]{#2}
        begin{document}
        begin{bytefield}[leftcurly=.,leftcurlyspace=0pt]{32}
        bitheader{0,8,16,24} \
        topwg{0}{begin{leftwordgroup}{}
        begin{rightwordgroup}{Standard Header}
        wordbox{1}{theheight}
        end{rightwordgroup}
        end{leftwordgroup}} \
        topwg{4}{begin{leftwordgroup}{}
        wordbox{2}{theheight}
        end{leftwordgroup}} \
        topwg{12}{begin{leftwordgroup}{}
        wordbox{2}{theheight}
        end{leftwordgroup}}
        end{bytefield}
        end{document}


        enter image description here



        If you plan on having more than two digits in the label to the left of the box, you can expand the width of the two makeboxes defined in topwg. The first number (3ex) determines the width of the labels on the left while the second number (2ex) specifies the left padding for those labels.



        To change the height of the left-label, change the amount of the raisebox at the beginning of topwg.



        I also changed the documentclass to article rather than standalone to prevent the bottom rule from being clipped (I'm not sure why).







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 5 mins ago









        Lekensteyn

        330129




        330129










        answered Jan 15 '14 at 15:25









        Steven B. SegletesSteven B. Segletes

        162k9206418




        162k9206418






























            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%2f154219%2fbest-way-to-vertically-align-leftwordgroup-with-top-of-wordbox-or-bitbox%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

            Can't compile dgruyter and caption packagesLaTeX templates/packages for writing a patent specificationLatex...

            Schneeberg (Smreczany) Bibliografia | Menu...

            Hans Bellmer Spis treści Życiorys | Upamiętnienie | Przypisy | Bibliografia | Linki zewnętrzne |...