Generalminted | How to create a new Environment

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
mbranko
Posts: 2
Joined: Sun Jun 26, 2011 4:08 pm

minted | How to create a new Environment

Post by mbranko »

Hi,

In a document I write there are lots of Java and XML listings displayed using minted package. Here is an example:

Code: Select all

\begin{listing}[htb]
\setlength\partopsep{-\topsep}
\addtolength\partopsep{-\parskip}
\begin{minted}{java}
public class X {
  public static void main(String[] args} {
  }
}
\end{minted}
\caption{Java listing}
\label{lst:java1}
\end{listing}
I would like to define a new environment that would save me some typing and use it like this:

Code: Select all

\begin{mylisting}{htb}{java}{Java listing}{lst:java1}
public class X {
  public static void main(String[] args} {
  }
}
\end{mylisting}
Fiddling with verbatim text in a new environment is beyond my knowledge of LaTeX. Is there a way to create such an evironment?

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

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

minted | How to create a new Environment

Post by localghost »

Study Section 6 of the minted manual.


Best regards and welcome to the board
Thorsten
mbranko
Posts: 2
Joined: Sun Jun 26, 2011 4:08 pm

Re: minted | How to create a new Environment

Post by mbranko »

Thanks!

But I'm trying to change parameters for minted's listing environment, not the minted environment (as described in Section 6).
Post Reply