How to justify escaped proportional text inside monospaced/fixed listing?Paragraph column in tabular working...

Does an object always see its latest internal state irrespective of thread?

Arrow those variables!

Why can't I see bouncing of a switch on an oscilloscope?

Can you really stack all of this on an Opportunity Attack?

What does "Puller Prush Person" mean?

RSA: Danger of using p to create q

tikz convert color string to hex value

Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?

What does the "remote control" for a QF-4 look like?

Replacing matching entries in one column of a file by another column from a different file

How do I deal with an unproductive colleague in a small company?

Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)

Find the result of this dual key cipher

How does quantile regression compare to logistic regression with the variable split at the quantile?

What defenses are there against being summoned by the Gate spell?

Paid for article while in US on F-1 visa?

Intersection point of 2 lines defined by 2 points each

Which country benefited the most from UN Security Council vetoes?

Can a vampire attack twice with their claws using Multiattack?

Fully-Firstable Anagram Sets

Could an aircraft fly or hover using only jets of compressed air?

Why is Minecraft giving an OpenGL error?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

What's the output of a record needle playing an out-of-speed record



How to justify escaped proportional text inside monospaced/fixed listing?


Paragraph column in tabular working only in the first columnWhy are my Images not correctly centered?Exhaustive Information about text alignment in TabularDifference between fixed-width and proportional typewriter fonts in listings?tex4ht and listings: lines don't break when using escapeinsideHow to fix text alignment?Align leaders to the right end of the enclosing hbox?lstnewenvironment/lstset : using colors conditionally emph/emphstyle - SAS: (in=_x) versus if x in (1,2)Same font for listing and escaped latexHow to arrange two bodies of text /sections side by side? (Custom Resume Building)













3















I have a fixed column listing on which I have escapped to LaTeX to write a proportional bit of text. The following pic illustrates what I have:



enter image description here



On the green box, the proportional text have perfectly aligned to the monospaced text, probably by accident, but that's exactly what I want.



On the red box, because of the subscript there, the text did not align properly to the fixed columns. (In this case, I believe the spacing should be increased so that the semicolon will align to the space above it.)



How could I justify escaped text (possibly with math mode equations) so that it would align to the closest number of fixed-width columns inside the listing?



Here's the code to reproduce the above table:



documentclass{article}

usepackage[utf8]{inputenc}
usepackage{graphicx}
usepackage{listings}
usepackage{color}
usepackage{mathtools}
usepackage{booktabs}

begin{document}

pagestyle{empty}

lstnewenvironment{rgxbc}
{lstset{
basicstyle=ttfamily,
columns=fixed,
escapeinside={@}{@}
}
}
{}

subsection{Relation to NFAs}

begin{center}
begin{tabular}{*3l}
toprule
multicolumn{1}{c}{emph{Expression}} & multicolumn{1}{c}{emph{NFA}} & multicolumn{1}{c}{emph{Bytecode}} \
midrule
$texttt{e}_{1}texttt{e}_{2}$ &
...
&
begin{rgxbc}
@textnormal{textit{code for }}$texttt{e}_{1}$@;
@textnormal{textit{code for }}$texttt{e}_{2}$@;
end{rgxbc}
\
hline
$texttt{e}_{1}| texttt{e}_{2}$ &
...
&
begin{rgxbc}
SPL .L1, .L2;
.L1: @textnormal{textit{code for }}$texttt{e}_{1}$@;
JMP .L3;
.L2: @textnormal{textit{code for }}$texttt{e}_{2}$@;
.L3:
end{rgxbc}
\
hline
$texttt{e?}$ &
...
&
begin{rgxbc}
SPL .L1, .L2;
.L1: @textnormal{textit{code for }}$texttt{e}$@;
.L2:
end{rgxbc}
\
hline
$texttt{e+}$ &
...
&
begin{rgxbc}
.L1: @textnormal{textit{code for }}$texttt{e}$@;
SPL .L1, .L2;
.L2:
end{rgxbc}
\
hline
$texttt{e*}$ &
...
&
begin{rgxbc}
.L1: SPL .L2, .L3;
.L2: @textnormal{textit{code for }}$texttt{e}$@;
JMP .L1;
.L3:
end{rgxbc}
\
bottomrule
end{tabular}
end{center}

end{document}









share|improve this question





























    3















    I have a fixed column listing on which I have escapped to LaTeX to write a proportional bit of text. The following pic illustrates what I have:



    enter image description here



    On the green box, the proportional text have perfectly aligned to the monospaced text, probably by accident, but that's exactly what I want.



    On the red box, because of the subscript there, the text did not align properly to the fixed columns. (In this case, I believe the spacing should be increased so that the semicolon will align to the space above it.)



    How could I justify escaped text (possibly with math mode equations) so that it would align to the closest number of fixed-width columns inside the listing?



    Here's the code to reproduce the above table:



    documentclass{article}

    usepackage[utf8]{inputenc}
    usepackage{graphicx}
    usepackage{listings}
    usepackage{color}
    usepackage{mathtools}
    usepackage{booktabs}

    begin{document}

    pagestyle{empty}

    lstnewenvironment{rgxbc}
    {lstset{
    basicstyle=ttfamily,
    columns=fixed,
    escapeinside={@}{@}
    }
    }
    {}

    subsection{Relation to NFAs}

    begin{center}
    begin{tabular}{*3l}
    toprule
    multicolumn{1}{c}{emph{Expression}} & multicolumn{1}{c}{emph{NFA}} & multicolumn{1}{c}{emph{Bytecode}} \
    midrule
    $texttt{e}_{1}texttt{e}_{2}$ &
    ...
    &
    begin{rgxbc}
    @textnormal{textit{code for }}$texttt{e}_{1}$@;
    @textnormal{textit{code for }}$texttt{e}_{2}$@;
    end{rgxbc}
    \
    hline
    $texttt{e}_{1}| texttt{e}_{2}$ &
    ...
    &
    begin{rgxbc}
    SPL .L1, .L2;
    .L1: @textnormal{textit{code for }}$texttt{e}_{1}$@;
    JMP .L3;
    .L2: @textnormal{textit{code for }}$texttt{e}_{2}$@;
    .L3:
    end{rgxbc}
    \
    hline
    $texttt{e?}$ &
    ...
    &
    begin{rgxbc}
    SPL .L1, .L2;
    .L1: @textnormal{textit{code for }}$texttt{e}$@;
    .L2:
    end{rgxbc}
    \
    hline
    $texttt{e+}$ &
    ...
    &
    begin{rgxbc}
    .L1: @textnormal{textit{code for }}$texttt{e}$@;
    SPL .L1, .L2;
    .L2:
    end{rgxbc}
    \
    hline
    $texttt{e*}$ &
    ...
    &
    begin{rgxbc}
    .L1: SPL .L2, .L3;
    .L2: @textnormal{textit{code for }}$texttt{e}$@;
    JMP .L1;
    .L3:
    end{rgxbc}
    \
    bottomrule
    end{tabular}
    end{center}

    end{document}









    share|improve this question



























      3












      3








      3








      I have a fixed column listing on which I have escapped to LaTeX to write a proportional bit of text. The following pic illustrates what I have:



      enter image description here



      On the green box, the proportional text have perfectly aligned to the monospaced text, probably by accident, but that's exactly what I want.



      On the red box, because of the subscript there, the text did not align properly to the fixed columns. (In this case, I believe the spacing should be increased so that the semicolon will align to the space above it.)



      How could I justify escaped text (possibly with math mode equations) so that it would align to the closest number of fixed-width columns inside the listing?



      Here's the code to reproduce the above table:



      documentclass{article}

      usepackage[utf8]{inputenc}
      usepackage{graphicx}
      usepackage{listings}
      usepackage{color}
      usepackage{mathtools}
      usepackage{booktabs}

      begin{document}

      pagestyle{empty}

      lstnewenvironment{rgxbc}
      {lstset{
      basicstyle=ttfamily,
      columns=fixed,
      escapeinside={@}{@}
      }
      }
      {}

      subsection{Relation to NFAs}

      begin{center}
      begin{tabular}{*3l}
      toprule
      multicolumn{1}{c}{emph{Expression}} & multicolumn{1}{c}{emph{NFA}} & multicolumn{1}{c}{emph{Bytecode}} \
      midrule
      $texttt{e}_{1}texttt{e}_{2}$ &
      ...
      &
      begin{rgxbc}
      @textnormal{textit{code for }}$texttt{e}_{1}$@;
      @textnormal{textit{code for }}$texttt{e}_{2}$@;
      end{rgxbc}
      \
      hline
      $texttt{e}_{1}| texttt{e}_{2}$ &
      ...
      &
      begin{rgxbc}
      SPL .L1, .L2;
      .L1: @textnormal{textit{code for }}$texttt{e}_{1}$@;
      JMP .L3;
      .L2: @textnormal{textit{code for }}$texttt{e}_{2}$@;
      .L3:
      end{rgxbc}
      \
      hline
      $texttt{e?}$ &
      ...
      &
      begin{rgxbc}
      SPL .L1, .L2;
      .L1: @textnormal{textit{code for }}$texttt{e}$@;
      .L2:
      end{rgxbc}
      \
      hline
      $texttt{e+}$ &
      ...
      &
      begin{rgxbc}
      .L1: @textnormal{textit{code for }}$texttt{e}$@;
      SPL .L1, .L2;
      .L2:
      end{rgxbc}
      \
      hline
      $texttt{e*}$ &
      ...
      &
      begin{rgxbc}
      .L1: SPL .L2, .L3;
      .L2: @textnormal{textit{code for }}$texttt{e}$@;
      JMP .L1;
      .L3:
      end{rgxbc}
      \
      bottomrule
      end{tabular}
      end{center}

      end{document}









      share|improve this question
















      I have a fixed column listing on which I have escapped to LaTeX to write a proportional bit of text. The following pic illustrates what I have:



      enter image description here



      On the green box, the proportional text have perfectly aligned to the monospaced text, probably by accident, but that's exactly what I want.



      On the red box, because of the subscript there, the text did not align properly to the fixed columns. (In this case, I believe the spacing should be increased so that the semicolon will align to the space above it.)



      How could I justify escaped text (possibly with math mode equations) so that it would align to the closest number of fixed-width columns inside the listing?



      Here's the code to reproduce the above table:



      documentclass{article}

      usepackage[utf8]{inputenc}
      usepackage{graphicx}
      usepackage{listings}
      usepackage{color}
      usepackage{mathtools}
      usepackage{booktabs}

      begin{document}

      pagestyle{empty}

      lstnewenvironment{rgxbc}
      {lstset{
      basicstyle=ttfamily,
      columns=fixed,
      escapeinside={@}{@}
      }
      }
      {}

      subsection{Relation to NFAs}

      begin{center}
      begin{tabular}{*3l}
      toprule
      multicolumn{1}{c}{emph{Expression}} & multicolumn{1}{c}{emph{NFA}} & multicolumn{1}{c}{emph{Bytecode}} \
      midrule
      $texttt{e}_{1}texttt{e}_{2}$ &
      ...
      &
      begin{rgxbc}
      @textnormal{textit{code for }}$texttt{e}_{1}$@;
      @textnormal{textit{code for }}$texttt{e}_{2}$@;
      end{rgxbc}
      \
      hline
      $texttt{e}_{1}| texttt{e}_{2}$ &
      ...
      &
      begin{rgxbc}
      SPL .L1, .L2;
      .L1: @textnormal{textit{code for }}$texttt{e}_{1}$@;
      JMP .L3;
      .L2: @textnormal{textit{code for }}$texttt{e}_{2}$@;
      .L3:
      end{rgxbc}
      \
      hline
      $texttt{e?}$ &
      ...
      &
      begin{rgxbc}
      SPL .L1, .L2;
      .L1: @textnormal{textit{code for }}$texttt{e}$@;
      .L2:
      end{rgxbc}
      \
      hline
      $texttt{e+}$ &
      ...
      &
      begin{rgxbc}
      .L1: @textnormal{textit{code for }}$texttt{e}$@;
      SPL .L1, .L2;
      .L2:
      end{rgxbc}
      \
      hline
      $texttt{e*}$ &
      ...
      &
      begin{rgxbc}
      .L1: SPL .L2, .L3;
      .L2: @textnormal{textit{code for }}$texttt{e}$@;
      JMP .L1;
      .L3:
      end{rgxbc}
      \
      bottomrule
      end{tabular}
      end{center}

      end{document}






      horizontal-alignment listings boxes






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 15 '16 at 10:24







      paulotorrens

















      asked Apr 14 '16 at 17:40









      paulotorrenspaulotorrens

      1184




      1184






















          1 Answer
          1






          active

          oldest

          votes


















          1














          You can force all the escaped code into a box a size a multiple of the listings fixed column width



          enter image description here



          documentclass{article}

          usepackage[utf8]{inputenc}
          usepackage{graphicx}
          usepackage{listings}
          usepackage{color}
          usepackage{mathtools}
          usepackage{booktabs}

          makeatletter
          defzz#1{{%
          setbox0hbox{{#1}}%
          count0=wd0
          dividecount0 by dimexprlst@widthfixedrelax
          dimen0=count0 dimexprlst@widthfixedrelax
          ifdimdimen0<wd0 advancedimen0 lst@widthfixedfi
          makebox[dimen0][l]{usebox0}}}%

          makeatletter


          begin{document}

          pagestyle{empty}

          lstnewenvironment{rgxbc}
          {lstset{
          basicstyle=ttfamily,
          columns=fixed,
          escapeinside={@}{@}
          }
          }
          {}



          subsection{Relation to NFAs}

          begin{center}
          begin{tabular}{*3l}
          toprule
          multicolumn{1}{c}{emph{Expression}} & multicolumn{1}{c}{emph{NFA}} & multicolumn{1}{c}{emph{Bytecode}} \
          midrule
          $texttt{e}_{1}texttt{e}_{2}$ &
          ...
          &
          begin{rgxbc}
          @zz{textnormal{textit{code for }}$texttt{e}_{1}$}@;
          @zz{textnormal{textit{code for }}$texttt{e}_{2}$}@;
          end{rgxbc}
          \
          hline
          $texttt{e}_{1}| texttt{e}_{2}$ &
          ...
          &
          begin{rgxbc}
          SPL .L1, .L2;
          .L1: @zz{textnormal{textit{code for }}$texttt{e}_{1}$}@;
          JMP .L3;
          .L2: @zz{textnormal{textit{code for }}$texttt{e}_{2}$}@;
          .L3:
          end{rgxbc}
          \
          hline
          $texttt{e?}$ &
          ...
          &
          begin{rgxbc}
          SPL .L1, .L2;
          .L1: @zz{textnormal{textit{code for }}$texttt{e}$}@;
          .L2:
          end{rgxbc}
          \
          hline
          $texttt{e+}$ &
          ...
          &
          begin{rgxbc}
          .L1: @zz{textnormal{textit{code for }}$texttt{e}$}@;
          SPL .L1, .L2;
          .L2:
          end{rgxbc}
          \
          hline
          $texttt{e*}$ &
          ...
          &
          begin{rgxbc}
          .L1: SPL .L2, .L3;
          .L2: @zz{textnormal{textit{code for }}$texttt{e}$}@;
          JMP .L1;
          .L3:
          end{rgxbc}
          \
          bottomrule
          end{tabular}
          end{center}

          end{document}





          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%2f304317%2fhow-to-justify-escaped-proportional-text-inside-monospaced-fixed-listing%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









            1














            You can force all the escaped code into a box a size a multiple of the listings fixed column width



            enter image description here



            documentclass{article}

            usepackage[utf8]{inputenc}
            usepackage{graphicx}
            usepackage{listings}
            usepackage{color}
            usepackage{mathtools}
            usepackage{booktabs}

            makeatletter
            defzz#1{{%
            setbox0hbox{{#1}}%
            count0=wd0
            dividecount0 by dimexprlst@widthfixedrelax
            dimen0=count0 dimexprlst@widthfixedrelax
            ifdimdimen0<wd0 advancedimen0 lst@widthfixedfi
            makebox[dimen0][l]{usebox0}}}%

            makeatletter


            begin{document}

            pagestyle{empty}

            lstnewenvironment{rgxbc}
            {lstset{
            basicstyle=ttfamily,
            columns=fixed,
            escapeinside={@}{@}
            }
            }
            {}



            subsection{Relation to NFAs}

            begin{center}
            begin{tabular}{*3l}
            toprule
            multicolumn{1}{c}{emph{Expression}} & multicolumn{1}{c}{emph{NFA}} & multicolumn{1}{c}{emph{Bytecode}} \
            midrule
            $texttt{e}_{1}texttt{e}_{2}$ &
            ...
            &
            begin{rgxbc}
            @zz{textnormal{textit{code for }}$texttt{e}_{1}$}@;
            @zz{textnormal{textit{code for }}$texttt{e}_{2}$}@;
            end{rgxbc}
            \
            hline
            $texttt{e}_{1}| texttt{e}_{2}$ &
            ...
            &
            begin{rgxbc}
            SPL .L1, .L2;
            .L1: @zz{textnormal{textit{code for }}$texttt{e}_{1}$}@;
            JMP .L3;
            .L2: @zz{textnormal{textit{code for }}$texttt{e}_{2}$}@;
            .L3:
            end{rgxbc}
            \
            hline
            $texttt{e?}$ &
            ...
            &
            begin{rgxbc}
            SPL .L1, .L2;
            .L1: @zz{textnormal{textit{code for }}$texttt{e}$}@;
            .L2:
            end{rgxbc}
            \
            hline
            $texttt{e+}$ &
            ...
            &
            begin{rgxbc}
            .L1: @zz{textnormal{textit{code for }}$texttt{e}$}@;
            SPL .L1, .L2;
            .L2:
            end{rgxbc}
            \
            hline
            $texttt{e*}$ &
            ...
            &
            begin{rgxbc}
            .L1: SPL .L2, .L3;
            .L2: @zz{textnormal{textit{code for }}$texttt{e}$}@;
            JMP .L1;
            .L3:
            end{rgxbc}
            \
            bottomrule
            end{tabular}
            end{center}

            end{document}





            share|improve this answer




























              1














              You can force all the escaped code into a box a size a multiple of the listings fixed column width



              enter image description here



              documentclass{article}

              usepackage[utf8]{inputenc}
              usepackage{graphicx}
              usepackage{listings}
              usepackage{color}
              usepackage{mathtools}
              usepackage{booktabs}

              makeatletter
              defzz#1{{%
              setbox0hbox{{#1}}%
              count0=wd0
              dividecount0 by dimexprlst@widthfixedrelax
              dimen0=count0 dimexprlst@widthfixedrelax
              ifdimdimen0<wd0 advancedimen0 lst@widthfixedfi
              makebox[dimen0][l]{usebox0}}}%

              makeatletter


              begin{document}

              pagestyle{empty}

              lstnewenvironment{rgxbc}
              {lstset{
              basicstyle=ttfamily,
              columns=fixed,
              escapeinside={@}{@}
              }
              }
              {}



              subsection{Relation to NFAs}

              begin{center}
              begin{tabular}{*3l}
              toprule
              multicolumn{1}{c}{emph{Expression}} & multicolumn{1}{c}{emph{NFA}} & multicolumn{1}{c}{emph{Bytecode}} \
              midrule
              $texttt{e}_{1}texttt{e}_{2}$ &
              ...
              &
              begin{rgxbc}
              @zz{textnormal{textit{code for }}$texttt{e}_{1}$}@;
              @zz{textnormal{textit{code for }}$texttt{e}_{2}$}@;
              end{rgxbc}
              \
              hline
              $texttt{e}_{1}| texttt{e}_{2}$ &
              ...
              &
              begin{rgxbc}
              SPL .L1, .L2;
              .L1: @zz{textnormal{textit{code for }}$texttt{e}_{1}$}@;
              JMP .L3;
              .L2: @zz{textnormal{textit{code for }}$texttt{e}_{2}$}@;
              .L3:
              end{rgxbc}
              \
              hline
              $texttt{e?}$ &
              ...
              &
              begin{rgxbc}
              SPL .L1, .L2;
              .L1: @zz{textnormal{textit{code for }}$texttt{e}$}@;
              .L2:
              end{rgxbc}
              \
              hline
              $texttt{e+}$ &
              ...
              &
              begin{rgxbc}
              .L1: @zz{textnormal{textit{code for }}$texttt{e}$}@;
              SPL .L1, .L2;
              .L2:
              end{rgxbc}
              \
              hline
              $texttt{e*}$ &
              ...
              &
              begin{rgxbc}
              .L1: SPL .L2, .L3;
              .L2: @zz{textnormal{textit{code for }}$texttt{e}$}@;
              JMP .L1;
              .L3:
              end{rgxbc}
              \
              bottomrule
              end{tabular}
              end{center}

              end{document}





              share|improve this answer


























                1












                1








                1







                You can force all the escaped code into a box a size a multiple of the listings fixed column width



                enter image description here



                documentclass{article}

                usepackage[utf8]{inputenc}
                usepackage{graphicx}
                usepackage{listings}
                usepackage{color}
                usepackage{mathtools}
                usepackage{booktabs}

                makeatletter
                defzz#1{{%
                setbox0hbox{{#1}}%
                count0=wd0
                dividecount0 by dimexprlst@widthfixedrelax
                dimen0=count0 dimexprlst@widthfixedrelax
                ifdimdimen0<wd0 advancedimen0 lst@widthfixedfi
                makebox[dimen0][l]{usebox0}}}%

                makeatletter


                begin{document}

                pagestyle{empty}

                lstnewenvironment{rgxbc}
                {lstset{
                basicstyle=ttfamily,
                columns=fixed,
                escapeinside={@}{@}
                }
                }
                {}



                subsection{Relation to NFAs}

                begin{center}
                begin{tabular}{*3l}
                toprule
                multicolumn{1}{c}{emph{Expression}} & multicolumn{1}{c}{emph{NFA}} & multicolumn{1}{c}{emph{Bytecode}} \
                midrule
                $texttt{e}_{1}texttt{e}_{2}$ &
                ...
                &
                begin{rgxbc}
                @zz{textnormal{textit{code for }}$texttt{e}_{1}$}@;
                @zz{textnormal{textit{code for }}$texttt{e}_{2}$}@;
                end{rgxbc}
                \
                hline
                $texttt{e}_{1}| texttt{e}_{2}$ &
                ...
                &
                begin{rgxbc}
                SPL .L1, .L2;
                .L1: @zz{textnormal{textit{code for }}$texttt{e}_{1}$}@;
                JMP .L3;
                .L2: @zz{textnormal{textit{code for }}$texttt{e}_{2}$}@;
                .L3:
                end{rgxbc}
                \
                hline
                $texttt{e?}$ &
                ...
                &
                begin{rgxbc}
                SPL .L1, .L2;
                .L1: @zz{textnormal{textit{code for }}$texttt{e}$}@;
                .L2:
                end{rgxbc}
                \
                hline
                $texttt{e+}$ &
                ...
                &
                begin{rgxbc}
                .L1: @zz{textnormal{textit{code for }}$texttt{e}$}@;
                SPL .L1, .L2;
                .L2:
                end{rgxbc}
                \
                hline
                $texttt{e*}$ &
                ...
                &
                begin{rgxbc}
                .L1: SPL .L2, .L3;
                .L2: @zz{textnormal{textit{code for }}$texttt{e}$}@;
                JMP .L1;
                .L3:
                end{rgxbc}
                \
                bottomrule
                end{tabular}
                end{center}

                end{document}





                share|improve this answer













                You can force all the escaped code into a box a size a multiple of the listings fixed column width



                enter image description here



                documentclass{article}

                usepackage[utf8]{inputenc}
                usepackage{graphicx}
                usepackage{listings}
                usepackage{color}
                usepackage{mathtools}
                usepackage{booktabs}

                makeatletter
                defzz#1{{%
                setbox0hbox{{#1}}%
                count0=wd0
                dividecount0 by dimexprlst@widthfixedrelax
                dimen0=count0 dimexprlst@widthfixedrelax
                ifdimdimen0<wd0 advancedimen0 lst@widthfixedfi
                makebox[dimen0][l]{usebox0}}}%

                makeatletter


                begin{document}

                pagestyle{empty}

                lstnewenvironment{rgxbc}
                {lstset{
                basicstyle=ttfamily,
                columns=fixed,
                escapeinside={@}{@}
                }
                }
                {}



                subsection{Relation to NFAs}

                begin{center}
                begin{tabular}{*3l}
                toprule
                multicolumn{1}{c}{emph{Expression}} & multicolumn{1}{c}{emph{NFA}} & multicolumn{1}{c}{emph{Bytecode}} \
                midrule
                $texttt{e}_{1}texttt{e}_{2}$ &
                ...
                &
                begin{rgxbc}
                @zz{textnormal{textit{code for }}$texttt{e}_{1}$}@;
                @zz{textnormal{textit{code for }}$texttt{e}_{2}$}@;
                end{rgxbc}
                \
                hline
                $texttt{e}_{1}| texttt{e}_{2}$ &
                ...
                &
                begin{rgxbc}
                SPL .L1, .L2;
                .L1: @zz{textnormal{textit{code for }}$texttt{e}_{1}$}@;
                JMP .L3;
                .L2: @zz{textnormal{textit{code for }}$texttt{e}_{2}$}@;
                .L3:
                end{rgxbc}
                \
                hline
                $texttt{e?}$ &
                ...
                &
                begin{rgxbc}
                SPL .L1, .L2;
                .L1: @zz{textnormal{textit{code for }}$texttt{e}$}@;
                .L2:
                end{rgxbc}
                \
                hline
                $texttt{e+}$ &
                ...
                &
                begin{rgxbc}
                .L1: @zz{textnormal{textit{code for }}$texttt{e}$}@;
                SPL .L1, .L2;
                .L2:
                end{rgxbc}
                \
                hline
                $texttt{e*}$ &
                ...
                &
                begin{rgxbc}
                .L1: SPL .L2, .L3;
                .L2: @zz{textnormal{textit{code for }}$texttt{e}$}@;
                JMP .L1;
                .L3:
                end{rgxbc}
                \
                bottomrule
                end{tabular}
                end{center}

                end{document}






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 7 hours ago









                David CarlisleDavid Carlisle

                497k4111441892




                497k4111441892






























                    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%2f304317%2fhow-to-justify-escaped-proportional-text-inside-monospaced-fixed-listing%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

                    Paper upload error, “Upload failed: The top margin is 0.715 in on page 3, which is below the required...

                    Emraan Hashmi Filmografia | Linki zewnętrzne | Menu nawigacyjneGulshan GroverGulshan...

                    How can I write this formula?newline and italics added with leqWhy does widehat behave differently if I...