Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/julienc91/listings-golang

Golang support for the listings package in LaTeX
https://github.com/julienc91/listings-golang

Last synced: 5 days ago
JSON representation

Golang support for the listings package in LaTeX

Awesome Lists containing this project

README

        

listings-golang
===============

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

* Author: Julien CHAUMONT (https://julienc.io)
* Version: 1.1
* Date: 2017-10-11
* Licence: MIT
* Url: http://github.com/julienc91/listings-golang
* Golang version: 1.11

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

## Usage

```latex

\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.

[1]: https://bitbucket.org/korfuri/golang-latex-listings