Created
August 26, 2012 10:49
-
-
Save adamatan/3477384 to your computer and use it in GitHub Desktop.
Tex code snippet problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Glider, a hacker emblem (http://www.catb.org/hacker-emblem/) | |
% Author: Alex Hirzel | |
% License: Public Domain | |
\documentclass[border=1mm]{article} | |
\usepackage{tikz} | |
%%%< | |
\usepackage{verbatim} | |
\usepackage{listings} | |
\begin{document} | |
\def\codefont{ | |
%\fontspec{Courier New} | |
\fontsize{9pt}{11pt}\selectfont} | |
\definecolor{codebgcolor}{HTML}{EDEDED} | |
\newenvironment{code} | |
{\begin{center} | |
\begin{tikzpicture} | |
\node [fill=codebgcolor,rounded corners=5pt] | |
\bgroup | |
\bgroup\codefont | |
\begin{tabular}{l}} | |
{\end{tabular} | |
\egroup | |
\egroup; | |
\end{tikzpicture} | |
\end{center}} | |
\section{Explaining using Code Snippets} | |
This particular Latex document makes use of code snippets to explain the concepts. | |
Here is our hello world program in Java. | |
\begin{code} | |
\begin{lstlisting} | |
public class HelloWorld { | |
public static void main(String[] args) { | |
/* ... more code ... */ | |
} | |
} | |
\end{lstlisting} | |
\end{code} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credit: http://randomlogs.wordpress.com/2010/02/06/