cpplatex
 All Classes Functions Pages
Public Member Functions | Public Attributes | Friends | List of all members
latex::doc::Document< DocType, font_size > Class Template Reference

#include <latex.hpp>

Public Member Functions

 Document (const std::string &title)
 
 Document (const std::string &title, const std::string &subtitle)
 
Documentuse (const std::string &import)
 
Documentwith_leading_content (const std::string &content)
 
Documentwith_toc ()
 
void write_leading (const std::string &content)
 
void insert (const Section &sect)
 
Documentoperator<< (const char *val)
 
Documentoperator<< (const std::string &val)
 
Documentoperator<< (const Section &val)
 
std::string to_string () const
 
void build (std::ostream &ss) const
 

Public Attributes

std::string title
 
std::string subtitle
 
bool use_toc
 
std::vector< std::string > imports
 
std::vector< std::string > leading_contents
 
std::vector< Sectionsections
 

Friends

std::ostream & operator<< (std::ostream &os, const Document &doc)
 

Detailed Description

template<typename DocType = doctypes::Article, std::uint8_t font_size = 12>
class latex::doc::Document< DocType, font_size >

Defines a document which is the root for generating a valid LaTeX document.

Documents must be given a title, and optionally a subtitle.

If the document type supports a table of contents, one is generated after the title page. Table of contents can be toggled via the ::use_toc variable or ::with_toc() function.

The ::use() function allows importing LaTeX packages.

Leading content is output first, followed by all sections (and their subsections).

Member Function Documentation

template<typename DocType = doctypes::Article, std::uint8_t font_size = 12>
void latex::doc::Document< DocType, font_size >::build ( std::ostream &  ss) const
inline

Helper for outputting the document to a generic std::ostream

template<typename DocType = doctypes::Article, std::uint8_t font_size = 12>
std::string latex::doc::Document< DocType, font_size >::to_string ( ) const
inline

Get the entire, LaTeX-formatted, document in a std::string.

template<typename DocType = doctypes::Article, std::uint8_t font_size = 12>
Document& latex::doc::Document< DocType, font_size >::use ( const std::string &  import)
inline

Import a package into the document

template<typename DocType = doctypes::Article, std::uint8_t font_size = 12>
Document& latex::doc::Document< DocType, font_size >::with_leading_content ( const std::string &  content)
inline

Builder pattern method for adding leading content

template<typename DocType = doctypes::Article, std::uint8_t font_size = 12>
Document& latex::doc::Document< DocType, font_size >::with_toc ( )
inline

Enable the table of contents if allowed by the document type

template<typename DocType = doctypes::Article, std::uint8_t font_size = 12>
void latex::doc::Document< DocType, font_size >::write_leading ( const std::string &  content)
inline

Write leading text (what comes before the sections in the document) into the document.


The documentation for this class was generated from the following file: