Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .gitmodules
Empty file.
19 changes: 10 additions & 9 deletions .latexmkrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ensure_path( 'TEXINPUTS', './configuration/' );
ensure_path( 'TEXINPUTS', 'configuration' );
ensure_path( 'TEXINPUTS', 'configuration/packages//');
ensure_path( 'LUAINPUTS', 'configuration' );
$pdf_mode=4;
$lualatex = 'lualatex %O -halt-on-error -synctex=1 --shell-escape %S';
$out_dir = '.';
Expand All @@ -23,7 +25,7 @@ sub mmz_analyze {
my $base = $$Pbase;
my $mmz_file = "$aux_dir1$base.mmz";
$mmz_has_new = '';

if (! -e $mmz_file) {
print "mmz_analyze: No mmz file '$mmz_file', so memoize is not being used.\n";
return 0;
Expand All @@ -46,7 +48,7 @@ sub mmz_analyze {
s/\s*$//; # Remove trailing space, including new lines
if ( /^\\mmzNewExtern\s+{([^}]+)}/ ) {
# We have a new memo item without a corresponding pdf file.
# It will be put in the aux directory.
# It will be put in the aux directory.
my $file = "$aux_dir1$1";
print "mmz_analyze: new extern for memoize: '$file'\n";
push @externs, $file;
Expand All @@ -64,11 +66,11 @@ sub mmz_analyze {
close $mmz_fh;
foreach (@dirs) {
if ( ! -e ) {
my @cmd = ( @memoize_extract, '--mkdir', $_ );
my @cmd = ( @memoize_extract, '--mkdir', $_ );
print "mmz_analyze: Making directory '$_' safely by running\n",
" @cmd\n";
mkdir $_;
}
}
}

rdb_ensure_files_here( @externs );
Expand All @@ -77,7 +79,7 @@ sub mmz_analyze {
if (@externs ) {
$mmz_has_new = $mmz_file;
}
return 0;
return 0;
}

#-----------------------------------------------------
Expand All @@ -94,7 +96,7 @@ sub mmz_extract_new {
print "mmz_extract_new : ENV{$_} = '$ENV{$_}'\n";
}
my @cmd = (@memoize_extract, '--format', 'latex',
'--pdf', $pdf_file, $mmz_file_no_path );
'--pdf', $pdf_file, $mmz_file_no_path );

if ( ! -e $pdf_file ) {
warn "mmz_extract_new: Cannot generate externs here, since no pdf file generated\n";
Expand All @@ -116,7 +118,7 @@ sub mmz_cleanup {
use strict;
print "============= I am mmz_cleanup \n";
my @cmd = ( @memoize_clean, '--all', '--yes',
'--prefix', $aux_dir,
'--prefix', $aux_dir,
"$aux_dir1$$Pbase.mmz" );
print "mmz_cleanup: Running\n @cmd\n";
my $ret = system @cmd;
Expand All @@ -125,4 +127,3 @@ sub mmz_cleanup {
}

#-----------------------------------------------------

259 changes: 259 additions & 0 deletions configuration.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
--- Configuration module for LuaLaTeX document
--
-- This module provides a centralized configuration system for LaTeX document settings,
-- asset management, references, and typesetting options. The configuration can be
-- overridden by a user-specific configuration file in the repository root.
--
-- @module configuration
-- @return Configuration table

local configuration = {}

-- Build system configuration
-- Controls output directories and build artifacts
configuration.build = {
-- Directory for intermediate build files (aux, log, etc.)
dir = 'build/',
-- Directory for final output files (PDFs)
out = 'pdf/'
}

-- Asset management configuration
-- Controls how external assets (images, tables, etc.) are handled
configuration.assets = {
-- Root directory for all assets
root = 'assets/',
-- Enable custom LaTeX macros for quick insertion of figures/tables/etc.
shortcuts = true,
-- Enable externalization of assets (caching processed versions)
-- For externalization 'memoize' package is used. Note that this
-- requires quite modern LaTeX version, as well as some external
--- dependicies, like Perl and PDF::API2 library
externalize = true,
-- Asset type configurations:
-- 'keep' - memoize puts files in the same directory as source
-- 'build' - memoize puts files into build directory
-- 'none' - disable memoization for this asset type
dirs = {
images = { path = 'images/', extern = 'keep' }, -- Raster/vector images
tables = { path = 'tables/', extern = 'build' }, -- Data tables, CSV files
diagrams = { path = 'diagrams/', extern = 'keep' }, -- Diagram source files
listings = { path = 'listings/', extern = 'keep' } -- Code listings
}
}

-- References and bibliography configuration
-- Manages citations, indexes, and knowledge graphs
configuration.references = {
enable = true,
--- Tooling for references
hyperref = {
shortref = {
{csname = 'picref', reftext = 'рис.'},
{csname = 'tabref', reftext = 'табл.'},
{csname = 'lstref', reftext = 'листинг'},
{csname = 'digref', reftext = 'диаг.'},
{csname = 'secref', reftext = 'разд.'}
},
hypersetup = {
breaklinks=true,
hyperindex=true,
colorlinks=true,
hidelinks=false,
hypertexnames='false', --- fix, cause right now false boolean filds are ignored
unicode=true,
pdfauthor={'Unknown Author'},
pdfsubject={'Document Subject'},
pdfkeywords={'keyword1, keyword2'},
pdftitle={'Document Title'},
bookmarksopen=false,
linktocpage=true,
plainpages=false,
pdfpagelabels=true,
-- Link colors
urlcolor='blue',
linkcolor='red',
filecolor='red',
citecolor='blue'
}
},
-- Bibliography sources configuration
bibtex = {
-- Base path for bibliography files
path = 'assets/bibliography',
style = 'numeric',
-- List of bibliography databases with display names
bibliographies = {
{
name = 'main', -- Main literature bibliography
title = 'Список литературы', -- Main literature bibliography
files = 'main.bib',
},
-- {
-- name = 'git', -- Software/online sources
-- title = 'Репозитории, трекеры, обсуждения', -- Software/online sources
-- files = { 'repos.bib', 'issues.bib' },
-- }
}
},
-- Index generation configuration (imakeidx package)
indexes = {
-- Enable index generation
enable = true,
-- imakeidx options
build = {'makeindex'},
-- Configure individual indexes
list = {
-- Symbol index
{
name = 'notation',
title = 'Список обозначений',
intoc = true,
--columns = 2,
--columnsep = '15pt',
--columnseprule = true,
},
-- Main subject index
{
name = nil,
title = 'Предметный указатель',
intoc = true,
}
}
},
-- Knowledge configuration (knowledge package)
-- knowledge = {
-- Enable knowledge graph functionality
-- enable = true,
-- Configuration file for knowledge package
-- config = '.knowledgerc.tex'
-- }
}

-- Float environment configuration
-- Controls figures, tables, listings, and other floating elements
configuration.floats = {
-- Enable plugin for handling macroses
enable = true,
-- Graphics scaling and sizing options
images = {
-- Enable quiver package for commutative diagrams
quiver = 'enabled', -- alternative is 'draft' or 'disabled'
-- TODO: Enable drawio package for draw.io diagram integration
-- drawio = 'enabled', -- alternative is 'draft' or 'disabled'

-- Default caption position
caption = 'below',
-- Default width ratio to \linewidth for regular figures (0.0-1.0)
figurewidth = 0.9,
-- Default width ratio for wrapfigure environments (0.0-1.0)
wrapfigurewidth = 0.4,
--- Whether or not create separate list of figures
makeidx = true,
},
tables = {
enables = true,
caption = 'above',
makeidx = true,
},
-- Code listing configuration
listing = {
-- Enable listing environment support
enable = true,
caption = 'above',
-- Enable syntax highlighting via pygmentize
pygmentize = true,
makeidx = true,
},
-- Caption and labeling configuration
captions = {
-- Language for automatic captions (e.g., "Figure", "Table")
lang = 'ru',
}
}

-- Typesetting and text macros configuration
-- Controls custom text formatting, shortcuts, and theorem environments
configuration.typesetting = {
-- Enable custom typesetting macros
enable = true,

-- Text shortcut configuration
shortcuts = true,

-- Formatting features
formatting = {
todo = true,
ulem = true,
},
-- Theorem and proof environment configuration
theorems = {
-- Enable theorem-like environments (theorem, lemma, proof, etc.)
enable = true,
--- Theorem naming style
--- plain:
--- theorem - numbered theorem
--- theorem* - unnumbered theorem
--- framed:
--- Theorem - numbered theorem, framed
--- Theorem* - unnumbered theorem, framed
--- theorem - numbered theorem, not framed
--- theorem* - unnumbered theorem, not framed
thmstyle = 'framed',
enviroments = {
{envname = 'theorem', name = 'Теорема'},
{envname = 'lemma', name = 'Лемма'},
{envname = 'proposition', name = 'Предложение'},
{envname = 'definition', name = 'Определение'},
{envname = 'remark', name = 'Замечание'},

}
}
}

-- Mathematical typesetting configuration
-- Controls math macros, symbols, and specialized notation
configuration.mathematics = {
-- Enable mathematical typesetting macros
enable = true,
mathcommand = 'error',
-- Mathematical domain-specific plugin configuration
plugins = {
-- Algebra plugin: groups, rings, fields, linear algebra
algebra = {
enable = true, -- Enable algebra macros
--knowledgify = true, -- Generate knowledge graph entries
--indexify = false, -- Add to index automatically
},
-- Calculus plugin: limits, derivatives, integrals
calculus = {
enable = true,
--knowledgify = true,
--indexify = false
},
-- Combinatorics plugin: combinations, permutations, graphs
combinatorics = {
enable = true,
--knowledgify = true,
--indexify = false
},
-- Probability plugin: distributions, expectations, random variables
probability = {
enable = true,
--knowledgify = true,
--indexify = false,
},
-- Foundations plugin: set theory, logic, category theory
foundations = {
enable = true,
--knowledgify = true,
--indexify = false
},
-- Complexity plugin: Big-O notation, complexity classes
complexity = {
enable = false -- Disabled by default
}
}
}

return configuration
Loading
Loading