5

I have a code which extends more than one page and I would like to break it into more than one page. I used breakable library but it has no effect on the created PDF and all the code appeared in the same page. Could someone help me please?

The following is a MWE.

\documentclass[11pt,letterpaper]{article}

\usepackage[left=1.00in, right=1.00in, top=1.00in, bottom=1.00in]{geometry}

\usepackage{tcolorbox}
\tcbuselibrary{minted,skins,breakable}

\newtcblisting{bashcode}[1][]{
  listing engine=minted,
  colback=bg,
  colframe=black!70,
  listing only,
  minted style=colorful,
  minted language=bash,
  minted options={linenos=true,numbersep=3mm,texcl=true,#1},
  left=5mm,enhanced,
  overlay={\begin{tcbclipinterior}\fill[black!25] (frame.south west)
            rectangle ([xshift=5mm]frame.north west);\end{tcbclipinterior}}
}
\definecolor{bg}{rgb}{0.85,0.85,0.85}

\begin{document}

\begin{bashcode}[]
# Unzip the file to the created directory
$ unzip code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4.zip -d ~

$ mkdir ~/camino

# Since the directory name is long, I do the following
$ mv ~/code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4/ ~/code
$ cd ~/camino
$ ls -F
apps/     inverters/           Makefile*  numerics/    sphfunc/
bin/      ISCodes/             man/       optimizers/  test/
data/     Jama/                matlab/    PointSets/   tools/
doc/      license.pdf*         mesd/      README.txt*  tractography/
fitters/  license.txt*         misc/      SGE/         UpdatePolicy.txt*
imaging/  logging.properties*  models/    simulation/

$ make

# Unzip the file to the created directory
$ unzip code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4.zip -d ~

$ mkdir ~/camino

# Since the directory name is long, I do the following
$ mv ~/code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4/ ~/code
$ cd ~/camino
$ ls -F
apps/     inverters/           Makefile*  numerics/    sphfunc/
bin/      ISCodes/             man/       optimizers/  test/
data/     Jama/                matlab/    PointSets/   tools/
doc/      license.pdf*         mesd/      README.txt*  tractography/
fitters/  license.txt*         misc/      SGE/         UpdatePolicy.txt*
imaging/  logging.properties*  models/    simulation/

$ make

# Unzip the file to the created directory
$ unzip code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4.zip -d ~

$ mkdir ~/camino

# Since the directory name is long, I do the following
$ mv ~/code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4/ ~/code
$ cd ~/camino
$ ls -F
apps/     inverters/           Makefile*  numerics/    sphfunc/
bin/      ISCodes/             man/       optimizers/  test/
data/     Jama/                matlab/    PointSets/   tools/
doc/      license.pdf*         mesd/      README.txt*  tractography/
fitters/  license.txt*         misc/      SGE/         UpdatePolicy.txt*
imaging/  logging.properties*  models/    simulation/

$ make

# Unzip the file to the created directory
$ unzip code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4.zip -d ~

$ mkdir ~/camino

# Since the directory name is long, I do the following
$ mv ~/code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4/ ~/code
$ cd ~/camino
$ ls -F
apps/     inverters/           Makefile*  numerics/    sphfunc/
bin/      ISCodes/             man/       optimizers/  test/
data/     Jama/                matlab/    PointSets/   tools/
doc/      license.pdf*         mesd/      README.txt*  tractography/
fitters/  license.txt*         misc/      SGE/         UpdatePolicy.txt*
imaging/  logging.properties*  models/    simulation/

$ make
\end{bashcode}

\end{document}

1 Answer 1

2

It's not enough to load the library; you need to pass the breakable option to the box:

\documentclass[11pt,letterpaper]{article}

\usepackage[left=1.00in, right=1.00in, top=1.00in, bottom=1.00in]{geometry}

\usepackage{tcolorbox}
\tcbuselibrary{minted,skins,breakable}

\newtcblisting{bashcode}[1][]{
  breakable,
  listing engine=minted,
  colback=bg,
  colframe=black!70,
  listing only,
  minted style=colorful,
  minted language=bash,
  minted options={linenos=true,numbersep=3mm,texcl=true,#1},
  left=5mm,enhanced,
  overlay={\begin{tcbclipinterior}\fill[black!25] (frame.south west)
            rectangle ([xshift=5mm]frame.north west);\end{tcbclipinterior}}
}
\definecolor{bg}{rgb}{0.85,0.85,0.85}

\begin{document}

\begin{bashcode}[]
# Unzip the file to the created directory
$ unzip code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4.zip -d ~

$ mkdir ~/camino

# Since the directory name is long, I do the following
$ mv ~/code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4/ ~/code
$ cd ~/camino
$ ls -F
apps/     inverters/           Makefile*  numerics/    sphfunc/
bin/      ISCodes/             man/       optimizers/  test/
data/     Jama/                matlab/    PointSets/   tools/
doc/      license.pdf*         mesd/      README.txt*  tractography/
fitters/  license.txt*         misc/      SGE/         UpdatePolicy.txt*
imaging/  logging.properties*  models/    simulation/

$ make

# Unzip the file to the created directory
$ unzip code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4.zip -d ~

$ mkdir ~/camino

# Since the directory name is long, I do the following
$ mv ~/code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4/ ~/code
$ cd ~/camino
$ ls -F
apps/     inverters/           Makefile*  numerics/    sphfunc/
bin/      ISCodes/             man/       optimizers/  test/
data/     Jama/                matlab/    PointSets/   tools/
doc/      license.pdf*         mesd/      README.txt*  tractography/
fitters/  license.txt*         misc/      SGE/         UpdatePolicy.txt*
imaging/  logging.properties*  models/    simulation/

$ make

# Unzip the file to the created directory
$ unzip code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4.zip -d ~

$ mkdir ~/camino

# Since the directory name is long, I do the following
$ mv ~/code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4/ ~/code
$ cd ~/camino
$ ls -F
apps/     inverters/           Makefile*  numerics/    sphfunc/
bin/      ISCodes/             man/       optimizers/  test/
data/     Jama/                matlab/    PointSets/   tools/
doc/      license.pdf*         mesd/      README.txt*  tractography/
fitters/  license.txt*         misc/      SGE/         UpdatePolicy.txt*
imaging/  logging.properties*  models/    simulation/

$ make

# Unzip the file to the created directory
$ unzip code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4.zip -d ~

$ mkdir ~/camino

# Since the directory name is long, I do the following
$ mv ~/code-163f67cbf550560aa351b3d0a3bbbd7a22863cb4/ ~/code
$ cd ~/camino
$ ls -F
apps/     inverters/           Makefile*  numerics/    sphfunc/
bin/      ISCodes/             man/       optimizers/  test/
data/     Jama/                matlab/    PointSets/   tools/
doc/      license.pdf*         mesd/      README.txt*  tractography/
fitters/  license.txt*         misc/      SGE/         UpdatePolicy.txt*
imaging/  logging.properties*  models/    simulation/

$ make
\end{bashcode}

\end{document}

enter image description here

You must log in to answer this question.

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