1

I am refering to this question: How to place two code snippets next to each other with minted?

I am trying to use the answer provided there, but with a headline over each code snippet. Sadly, this is causing a vertical shift of the right box, so that the right box is placed a bit below the left box.

The first figure in the code is with headlines (VBS and JS), the other is without headlines.

\documentclass[
ngerman, % German
english, % English (default)
toc=listof,
toc=bibliography,
]{scrreprt}

\usepackage{minted}
% \usepackage{mathpazo} --> This is causing the shift of the boxes!

\begin{document}

\begin{figure}[!h]
    \begin{minipage}{0.5\textwidth}
        \centering
        VBS
        \begin{minted}[fontsize=\footnotesize, frame=single]{vbscript}
            EXAMPLE CODE
            EXAMPLE CODE
            EXAMPLE CODE
        \end{minted}
        %\captionof{figure}{VBS}
    \end{minipage}
    \begin{minipage}{0.5\textwidth}
        \centering
        JS
        \begin{minted}[fontsize=\footnotesize, frame=single]{js}
            EXAMPLE CODE
            EXAMPLE CODE
            EXAMPLE CODE
        \end{minted}
        %\captionof{figure}{JS}
    \end{minipage}
    \captionof{figure}{TEST 1.}
    \label{figure:test1}
\end{figure}

\begin{figure}[!h]
    \begin{minipage}{0.5\textwidth}
        \centering
        \begin{minted}[fontsize=\footnotesize, frame=single]{vbscript}
            EXAMPLE CODE
            EXAMPLE CODE
            EXAMPLE CODE
        \end{minted}
        %\captionof{figure}{VBS}
    \end{minipage}
    \begin{minipage}{0.5\textwidth}
        \centering
        \begin{minted}[fontsize=\footnotesize, frame=single]{js}
            EXAMPLE CODE
            EXAMPLE CODE
            EXAMPLE CODE
        \end{minted}
        %\captionof{figure}{JS}
    \end{minipage}
    \captionof{figure}{TEST 2.}
    \label{figure:test2}
\end{figure}


\end{document}
2
  • Welcome to tex.sx. Please extend your code to be compilable, beginning with \documentclass and ending with \end{document}. Different document classes could have different results, so we need more information to produce an accurate answer. Commented Sep 14, 2023 at 14:28
  • 1
    @Martin Have a look at tex.stackexchange.com/questions/7453/… . The missing % signs after your minipages will act like spaces and thus make your line wider than 2 times .5\linewidth Commented Sep 15, 2023 at 15:42

1 Answer 1

1

I finally found the problem. The package mathpazo caused the shift of the minipage-boxes.

No idea why, I will just leave the package out - but if someone wants to investigate this, please answer in this thread.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .