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}

  • 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. – barbara beeton Sep 14 '23 at 14:28
  • 1
    @Martin Have a look at https://tex.stackexchange.com/questions/7453/what-is-the-use-of-percent-signs-at-the-end-of-lines-why-is-my-macro-creat . The missing % signs after your minipages will act like spaces and thus make your line wider than 2 times .5\linewidth – samcarter_is_at_topanswers.xyz Sep 15 '23 at 15:42

1 Answers1

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.