Graphics, Figures & TablesSide by side listings that are longer than one page

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
herdom
Posts: 2
Joined: Sat Apr 02, 2011 2:57 am

Side by side listings that are longer than one page

Post by herdom »

Hello!

I am trying to achieve following Latex behaviour: I have two listings that are longer than one page and I would like to place them side-by-side. I don't stick at using verbatim environment.

I have already tried something like this:

Code: Select all

\begin{figure}[ht]
\begin{minipage}[b]{0.5\linewidth}
\centering
\begin{verbatim}
%many lines with Python code
\end{verbatim}
\caption{default}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.5\linewidth}
\centering
\begin{verbatim}
%many lines with Python code
\end{verbatim}
\caption{default}
\end{minipage}
\end{figure}
but above code doesn't work with listings that are longer than one page.

This is my preamble:

Code: Select all

\documentclass[a4paper,11pt]{article}
\usepackage[utf8x]{inputenc}    
\usepackage[pdftex]{graphicx}
\usepackage{indentfirst}

\setlength{\textheight}{24cm}
\setlength{\textwidth}{15.92cm}
\setlength{\footskip}{10mm}
\setlength{\oddsidemargin}{0mm}
\setlength{\evensidemargin}{0mm}
\setlength{\topmargin}{0mm}
\setlength{\headsep}{5mm}

\makeatletter 
\def\thesection{\arabic{section}.}
\def\thesubsection{\thesection\arabic{subsection}}
\makeatother

\usepackage{amsmath}
\usepackage{amssymb}

\usepackage[pdfpagemode=None,bookmarksopen=false,colorlinks=true,linkcolor=blue]{hyperref}
Last edited by herdom on Fri Apr 22, 2011 4:55 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Side by side listings that are longer than one page

Post by localghost »

herdom wrote:[…] I have two listings that are longer than one page and I would like to place them side-by-side. […]
Try the parallel package. It allows to typeset parallel content on facing pages.
herdom wrote:[…] I don't stick at using verbatim environment. […]
For better tagging of certain code try the listings or minted package.


Best regards and welcome to the board
Thorsten
herdom
Posts: 2
Joined: Sat Apr 02, 2011 2:57 am

Side by side listings that are longer than one page

Post by herdom »

localghost wrote:
herdom wrote:[…] I have two listings that are longer than one page and I would like to place them side-by-side. […]
Try the parallel package. It allows to typeset parallel content on facing pages.
parallel works like a charm:). Thank you! I have also found this page: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=parallel . There are mentioned other packages that do the same thing:).
localghost wrote:
herdom wrote:[…] I don't stick at using verbatim environment. […]
For better tagging of certain code try the listings or minted package.
I will try! Thank you:)!
Post Reply