Different from writing a report or thesis involving code, I have the goal of producing a transcription of a C++ solution involving many projects with many .h and .cpp files. Furthermore, this document I am trying to produce will have a focus on the mathematical equations.

So far, I am giving each project a chapter, each file a section and each function a subsection, using \begin{chapter}{Project}, etc.

So my questions are:

  1. Is there a document class appropriate for this undertaking?
  2. If not, has anyone done this before, and what is the best method you've found?
  3. If no one has done this before, what ideas do you all have?
  4. At the furthest extreme, would I have to create a new document class?

As a side question, I am using TeXmaker. Any idea how to get \begin{section}{File.cpp} to appear in the structure pane?

  • 3
    Have a look at the listings and minted packages. They are both exceptionally good for code highlighting. My preference is to use listings and, in particular, the \lstinputlisting command to directly include source from an external file. – Andrew Nov 14 '18 at 23:54
  • 1
    See if your university has a specific document class or template for LaTeX. Otherwise, start with book,cls and get the university requirements. – John Kormylo Nov 15 '18 at 5:34
  • 2
    The ltxdoc documentclass is set up for documenting style packages, and may (or not) be adaptable to your need. The numberedblock provides a way to typeset code blocks in the manner of numbered equations. – Steven B. Segletes Nov 15 '18 at 10:42
  • 1
    I suggest the tcolorbox documentation library if eye-candy is important. – user31729 Dec 31 '18 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.