1
As shown in Listing \ref{lst:dummylocalxmega} and Listing \ref{lst:dummylocalstm}, in the case of an implementation where  dummy operations use local variables, it does not find a part corresponding to the dummy Sbox operations in the assembly code.
    It is presumed that the compiler (WinAVR 4.3.3) provided by ChipWhisperer-Lite(CW1173) judged as operations irrelevant to the output of SubBytes function in the optimization

    \setcounter{lstlisting}{0}
    \renewcommand{\thelstlisting}{2.\arabic{lstlisting}}
    \begin{minipage}[H]{.45\textwidth}
        \lstinputlisting[language=nasm, style=nasm, caption=Assembly code for real operation when dummy operations uses local variables on the XMEGA128D4 microprocessor., label=lst:reallocalxmega]{asm_local_rl_XMEGA.asm}
    \end{minipage}
    \hfill
    \begin{minipage}[H]{0.45\textwidth}
        \lstinputlisting[language=nasm, style=nasm, caption=Assembly code for dummy operation when dummy operations uses local variables on the XMEGA128D4 microprocessor., label=lst:dummylocalxmega]{asm_local_dm_XMEGA.asm}
    \end{minipage}

    \setcounter{lstlisting}{0}
    \renewcommand{\thelstlisting}{3.\arabic{lstlisting}}
    \begin{minipage}[H]{.45\textwidth}
        \lstinputlisting[language=nasm, style=nasm, caption=Assembly code for real operation when dummy operations uses local variables on the STM32F303 microprocessor., label=lst:reallocalstm]{asm_local_rl_STM.asm}
    \end{minipage}
    \hfill
    \begin{minipage}[H]{0.45\textwidth}
        \lstinputlisting[language=nasm, style=nasm, caption=Assembly code for dummy operation when dummy operations uses local variables on the STM32F303 microprocessor., label=lst:dummylocalstm]{asm_local_dm_STM.asm}
    \end{minipage}

    \hfill \break
    process.
    Nevertheless, the power consumption traces of the SubBytes function can be divided into 32 parts because the ord array referenced in the switch-case statement is not optimized.
    Operations using unoptimized array are also not optimization targets, so a loop consisting of switch-case statements is performed, even though internal operations are not performed.

Above latex code

The above latex code creates a pdf as shown above picture.

In fact, the paragraph above the listings and the paragraph below are one paragraph.

But I want to force partition for efficient space utilization.

So I want to apply equally distribute to the last line of the paragraph above the listings.

What should I do?

egreg
  • 1,121,712
  • You need a float instead of a minipage. You can create a new float type (newfloat package) or use figure or table. It doesn't matter so long as you don't add a \caption. BTW, there is no [H] option for minipage, only [t] [b] or [c] (locates baseline) and you don't want [H] anyway. – John Kormylo Jul 04 '19 at 15:15
  • @JohnKormylo So, how to use that? – Jong Hyeok Lee Jul 05 '19 at 00:10
  • I would have already shown you if you had an executable MWE (one which doesn't require files not included). – John Kormylo Jul 05 '19 at 14:13
  • It occurred to me that part of the problem is that you want to instert the listings into the middle of a paragraph. While floats can only be created between paragraphs, they can split paragraphs at the top or bottom of a page, but not using [h]. Also, [bt] will always go to the top of the page first. See https://tex.stackexchange.com/questions/425892/place-figure-at-bottom-of-this-page-or-the-top-of-the-next-page?r=SearchResults&s=1|36.2757 – John Kormylo Jul 05 '19 at 15:00
  • @JohnKormylo floats, including [h] floats, can be placed mid-paragraph without disturbing the line breaking. – David Carlisle Aug 26 '21 at 09:57

1 Answers1

1

You are forcing the end of the paragraph before the listing by including blank lines and \break which isn't needed) But you want the following text to be part of the same paragraph so remove the blank lines and use a [h] float which will be inserted between the lines after normal line breaking.

As you want to place two listings side by side you can not use the lstistings float option you need to place them in a surrounding float You could use a figure environment but it is better to use an environment using the float type set up by the package to ensure that it stays in sequence with other floating listings. So I define lstfloat here (the float type is already set up by the listings package but only made available via the float keyword, not as an environment)

enter image description here

\documentclass{article}
\usepackage{listings}
\makeatletter
\newenvironment{lstfloat}
               {\@float{lstlisting}}
               {\end@float}

\makeatother \begin{document}

One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. \begin{lstfloat}[htp] \begin{minipage}[t]{.45\linewidth} \begin{lstlisting}[caption=aaa aaa aaa] a a a \end{lstlisting} \end{minipage}\hfill \begin{minipage}[t]{.45\linewidth} \begin{lstlisting}[caption=bbb bbb bbb] bbbbb bbbb bbb bb b \end{lstlisting} \end{minipage} \end{lstfloat} One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. One two three four five. Red blue green black white. \end{document}

Note I used [htp] here so if the construct does not fit on the page, it will float to the top of the next, as usual.

David Carlisle
  • 757,742