I'm looking for any useful class or package or style (template) to help me write up a programming project report.
I've found many LaTeX tutorials but I found it quite hard to start from scratch.
I'm looking for any useful class or package or style (template) to help me write up a programming project report.
I've found many LaTeX tutorials but I found it quite hard to start from scratch.
listings
package provides an elegant way to include an external programming source code as demonstrated below.
Assume that you have an external programming source code named project.cs
:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
You can import the code from within your report.
\documentclass{report}
\usepackage{xcolor}
\usepackage{listings}
\lstset
{
basicstyle=\tt\scriptsize,
identifierstyle=\color{blue},
commentstyle=\color{red},
breaklines=true,
backgroundcolor=\color{yellow!30},
numbers=none,
language=[Sharp]C
}
\begin{document}
\lstinputlisting{project.cs}
\end{document}
Output:
For further details how to use listings
package, run texdoc listings
to show the listings
package manual. There are too many options that I cannot show one by one.
For drawing UML, you can use PSTricks package named as pst-uml
.
If you're just looking for something other than the normal document classes, here's an example using tufte-handout, TikZ for UML diagrams, and the listings example from @CounterTerrorist
\documentclass{tufte-handout}
\usepackage{listings}
\lstset
{
basicstyle=\ttfamily\scriptsize,
identifierstyle=\color{blue},
commentstyle=\color{red},
breaklines=true,
backgroundcolor=\color{yellow!30},
numbers=none,
language=[Sharp]C
}
\usepackage{tikz-uml}
% from http://www.ensta-paristech.fr/~kielbasi/tikzuml/index.php?lang=en
\title{A Report with Code and UML}
\author{Somebody Else}
\begin{document}
\maketitle
\section{Section Heading}
This is the introductory text of your report, with enough text to show the
column size. There's a UML diagram in Figure~\ref{fig:uml-diagram}.
\begin{figure}
\begin{tikzpicture}
% From http://www.ensta-paristech.fr/~kielbasi/tikzuml/doc/tikzuml-v0.9.6-fr.pdf
% section 1.2
\umlemptyclass{A1}
\umlemptyclass[x=3,y=-3]{A2}
\umluniaggreg[arg2=a,mult2=1,pos2=0.9]{A1}{A2}
\umluniassoc[geometry=-|,arg1=x,mult1=1,pos1=1.9,arg2=y,mult2=*,pos2=0.2]{A1}{A2}
\umlunicompo[arg=z,mult=1..*,pos=0.8,angle1=-90,angle2=-140,loopsize=2cm]{A2}{A2}
\end{tikzpicture}
\caption{UML diagram}
\label{fig:uml-diagram}
\end{figure}
This is the second paragraph of your report, with enough text to show the
indentation.
\subsection{Subsection Heading}
Also, we can include code, as shown in Listing~\ref{lst:csharp}.
\begin{lstlisting}[caption={A C\# code snippet},label={lst:csharp}]
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
\end{lstlisting}
\end{document}