0

I have a piece of code in a minted environment and I have divided the code the into some "blocks". I have shown this by creating dots between the blocks, but I want to create a bracket on the right side of the code to specify the block names as well. The following is my minted code and the commands:


\renewcommand\theFancyVerbLine{%
\ifnum\value{FancyVerbLine}=2 
  \setcounter{FancyVerbLine}{2}\ldots
\else\ifnum\value{FancyVerbLine}=5
  \setcounter{FancyVerbLine}{6}\ldots
\else\ifnum\value{FancyVerbLine}=17
  \setcounter{FancyVerbLine}{30}\ldots
\else
\arabic{FancyVerbLine}%
\fi
\fi
\fi

}

\begin{minted}[ frame=lines, framesep=2mm, baselinestretch=1.2, fontsize=\scriptsize, linenos ]{C} // convert binary to decimal

#include <stdio.h> #include <math.h>

// function prototype int convert(long long);

int main() { long long n; printf("Enter a binary number: "); scanf("%lld", &n); printf("%lld in binary = %d in decimal", n, convert(n)); return 0; }

// function definition int convert(long long n) { int dec = 0, i = 0, rem;

while (n!=0) { rem = n % 10; n /= 10; dec += rem * pow(2, i); ++i; }

return dec; }

\end{minted}

And this is how I want the brackets to look like:

desired output

How can I add these brackets and the block names into my minted environment?

Paul Gessler
  • 29,607
Lily
  • 1
  • 1

0 Answers0