Skip to content

Instantly share code, notes, and snippets.

@adamatan
Created August 26, 2012 10:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamatan/3477384 to your computer and use it in GitHub Desktop.
Save adamatan/3477384 to your computer and use it in GitHub Desktop.
Tex code snippet problem
% 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}
@adamatan
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment