NoTeX 1.0.0
A modern noteworthy LaTeX template
Loading...
Searching...
No Matches
notex::templates Namespace Reference

Enumerations

enum class  ProjectType { MONO , MULTI }

Functions

std::string_view to_string (ProjectType type)
std::optional< ProjectTypeproject_type_from_string (std::string_view name)
 Parses a project type name.
std::string mono_main (std::string_view class_path)
 Generates the entry file for a single-file project.
std::string multi_main (std::string_view class_path, const std::vector< std::string > &section_stems={"1_introduction"})
 Generates the entry file for a multi-file project, referencing section_stems in order.
std::string section_stem (int number, std::string_view title)
 Computes the filename stem (no directory, no extension) for a numbered section.
std::string section (int number, std::string_view title)
 Generates a numbered section subfile.
std::string bibliography_starter ()

Detailed Description

NoTeX Copyright (c) 2026 Marco Tallone Licensed under the MIT License. See LICENCE for details.

Implements templates: the encoded project skeletons used by Manager::init.

Enumeration Type Documentation

◆ ProjectType

enum class notex::templates::ProjectType
strong

Which project skeleton to scaffold: a single main.tex, or a main.tex plus a sections/ tree of subfiles.

Enumerator
MONO 

A single main.tex file.

MULTI 

main.tex plus a sections/ directory of subfiles.

Definition at line 22 of file templates.hpp.

Function Documentation

◆ bibliography_starter()

std::string notex::templates::bibliography_starter ( )
Returns
A starter bibliography file with one example entry.

Definition at line 167 of file templates.cpp.

Referenced by notex::Manager::add_bibliography().

◆ mono_main()

std::string notex::templates::mono_main ( std::string_view class_path)

Generates the entry file for a single-file project.

Parameters
class_pathArgument to \documentclass, e.g. "notex" or "settings/notex".

Definition at line 140 of file templates.cpp.

Referenced by notex::Manager::init(), and notex::Manager::reset().

◆ multi_main()

std::string notex::templates::multi_main ( std::string_view class_path,
const std::vector< std::string > & section_stems = {"1_introduction"} )

Generates the entry file for a multi-file project, referencing section_stems in order.

Parameters
class_pathSee mono_main().
section_stemsFilename stems (as returned by section_stem(), no directory or extension) of the sections to reference via \subfile, in order; defaults to a single introductory section, matching a fresh project's initial state.

Definition at line 144 of file templates.cpp.

Referenced by notex::Manager::init(), and notex::Manager::reset().

◆ project_type_from_string()

std::optional< ProjectType > notex::templates::project_type_from_string ( std::string_view name)

Parses a project type name.

Parameters
nameCandidate name, e.g. from a command-line argument.
Returns
The matching ProjectType, or std::nullopt if name is neither "mono" nor "multi".

Definition at line 134 of file templates.cpp.

References MONO, and MULTI.

◆ section()

std::string notex::templates::section ( int number,
std::string_view title )

Generates a numbered section subfile.

Parameters
numberSection number; substituted only into a landmark comment, since the number itself lives in the filename rather than the file's content.
titleSection title, substituted into the \section{} heading.

Definition at line 161 of file templates.cpp.

Referenced by notex::Manager::add_section(), and notex::Manager::init().

◆ section_stem()

std::string notex::templates::section_stem ( int number,
std::string_view title )

Computes the filename stem (no directory, no extension) for a numbered section.

Parameters
numberSection number, prefixed onto the returned stem.
titleSection title, slugified (lower-cased, non-alphanumeric runs collapsed to a single underscore) to form the rest of the stem.
Returns
e.g. section_stem(1, "Introduction") returns "1_introduction".

Definition at line 157 of file templates.cpp.

Referenced by notex::Manager::add_section(), and notex::Manager::init().

◆ to_string()

std::string_view notex::templates::to_string ( ProjectType type)
Returns
"mono" or "multi".

Definition at line 124 of file templates.cpp.

References MONO, and MULTI.

Referenced by notex::Manager::init().