Skip to content

Instantly share code, notes, and snippets.

@annesteenbeek
Last active November 2, 2015 14:35
Show Gist options
  • Save annesteenbeek/98c7e1be1a909d72caaf to your computer and use it in GitHub Desktop.
Save annesteenbeek/98c7e1be1a909d72caaf to your computer and use it in GitHub Desktop.
bash script to convert c++ source code to one Tex file
\documentclass[10pt,a4paper,twoside]{article}
\usepackage[a4paper,top=1in, bottom=1in, right=1in, left=1in]{geometry}
\usepackage{listings}
\usepackage{textcomp}
\usepackage[usenames,dvipsnames]{color} %% Allow color names
\definecolor{listinggray}{gray}{0.9}
\definecolor{lbcolor}{rgb}{0.95,0.95,0.95}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{dred}{rgb}{0.545,0,0}
\lstset{
backgroundcolor=\color{lbcolor},
tabsize=4,
language=[GNU]C++,
basicstyle=\scriptsize,
upquote=true,
aboveskip={1.5\baselineskip},
columns=fixed,
showstringspaces=false,
extendedchars=false,
breaklines=true,
prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
numbers=left,
showtabs=false,
showspaces=false,
showstringspaces=false,
identifierstyle=\ttfamily,
keywordstyle=\color[rgb]{0,0,1},
commentstyle=\color[rgb]{0.026,0.112,0.095},
stringstyle=\color[rgb]{0.627,0.126,0.941},
numberstyle=\color[rgb]{0.205, 0.142, 0.73},
}
\lstset{
backgroundcolor=\color{lbcolor},
language=C++,
tabsize=2,
captionpos=b,
tabsize=3,
numbers=left,
numberstyle=\tiny,
numbersep=5pt,
breaklines=true,
showstringspaces=false,
basicstyle=\footnotesize\sffamily\color{black},
keywordstyle=\color[rgb]{0,0,1},
commentstyle=\color{dkgreen},
stringstyle=\color{dred}
}
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}
\begin{document}
\tableofcontents
\newpage
\section{main.cpp}
\lstinputlisting{main.cpp}
\newpage
\section{filterConstants.h}
\lstinputlisting{filterConstants.h}
\newpage
\section{debug.cpp}
\lstinputlisting{debug.cpp}
\newpage
\section{tmp.tex}
\lstinputlisting{tmp.tex}
\newpage
\section{actuators.h}
\lstinputlisting{actuators.h}
\newpage
\section{filename}
\lstinputlisting{filename}
\newpage
\section{config.h}
\lstinputlisting{config.h}
\newpage
\section{filterConstants.cpp}
\lstinputlisting{filterConstants.cpp}
\newpage
\section{actuators.cpp}
\lstinputlisting{actuators.cpp}
\newpage
\section{PID/PID.cpp}
\lstinputlisting{PID/PID.cpp}
\newpage
\section{PID/PID.h}
\lstinputlisting{PID/PID.h}
\newpage
\section{serialcom.h}
\lstinputlisting{serialcom.h}
\newpage
\section{emg.cpp}
\lstinputlisting{emg.cpp}
\newpage
\section{emg.h}
\lstinputlisting{emg.h}
\newpage
\section{buttons.h}
\lstinputlisting{buttons.h}
\newpage
\section{buttons.cpp}
\lstinputlisting{buttons.cpp}
\newpage
\section{debug.h}
\lstinputlisting{debug.h}
\newpage
\section{serialcom.cpp}
\lstinputlisting{serialcom.cpp}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment