1

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.

3
  • Welcome to TeX.sx! It would be easier to answer you question if you elaborate on your needs. What kind of report are you writing, what will it include (figures, tables), have you got an typographical requirements, etc?
    – N.N.
    Dec 27, 2011 at 9:44
  • 1
    What kind of programming project for which you want to make a report? You want to draw UML diagram, you want to include code snippet? What else? Dec 27, 2011 at 9:46
  • A few code snippets and diagrams. I think I look for template that just are nice to see (and not as black and white as most Latex ones).
    – magnetik
    Dec 27, 2011 at 9:59

2 Answers 2

4

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:

enter image description here

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.

3

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

enter image description here

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .