LaCodon / listings-golang

Golang support for the listings package in LaTeX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

listings-golang

This package provides Golang support for the listings package in LaTeX.

This version was adapted from the golang-latex-listings project.

Usage

\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{listings-golang} % import this package after listings
\usepackage{color}

\lstset{ % add your own preferences
    frame=single,
    basicstyle=\footnotesize,
    keywordstyle=\color{red},
    numbers=left,
    numbersep=5pt,
    showstringspaces=false, 
    stringstyle=\color{blue},
    tabsize=4,
    language=Golang % this is it !
}

\begin{document}
\begin{lstlisting}
package main

import "fmt"

func main() {
    fmt.Println("Hello World!")
}
\end{lstlisting}
\end{document}

Don't forget to put the file listings-golang.sty in the folder of your project, or with the other installed packages.

About

Golang support for the listings package in LaTeX

License:MIT License


Languages

Language:TeX 100.0%