CTAN Comprehensive TeX Archive Network

Directory macros/latex/contrib/modular

Copyright 2017 Daniel Thomas Sank (sank.daniel@gmail.com)

This work may be distributed and/or modified under the conditions of the LaTeX
Project Public License, either version 1.3 of this license or (at your option)
any later version. The latest version of this license is in
and version 1.3 or later is part of all distributions of LaTeX version
2005/12/01 or later.

This work has the LPPL maintenance status `maintained'.

The Current Maintainer of this work is Daniel Thomas Sank.

This work consists of the files modular.sty and README.md.



The \chapter, \section, etc. commands in are great until you want to reuse document fragments in multiple containing documents where the heading levels need to be different. For example, suppose you write an article about octopuses containing \section's "Habitat" and "Life cycle". Now suppose you want to write an article about sea animals with a \section for octopuses. Within that section, the parts about habitat and life cycle should be subsections. The built-in commands do not support this, but modular does!

We need to make our headings relative rather than absolute, and we need a way to import document fragments at levels relative to the point from which they're imported. The coseoul package gives us relative headings, but it doesn't provide the import mechanism we need. This package builds on coseoul providing the \subimportlevel macro, which enables fully modular importing of sub-documents and gets the relative headings right.


See doc/modular.pdf distributed with this package. It's source is modular.tex. The source for the examples shown there are in the documentation/example and documentation/example/octopus directories. You can build the files there yourself to experiment with the package. See documentation/README.md for more information.


See the package documentation for a more complete description of the problem this package solves and how to use the subimportlevel macro. For an extended discussion of the modularity problem, a detailed review of failed attempts using only the import and coseoul packages, and a step-by-step explanation of how the \subimportlevel macro provided by this package works, see this post.

This package is developed on github.

Download the contents of this package in one zip archive (144.0k).

modular – Relative section headings for modular documents

sections have absolute depth, e.g. \section, \subsection, etc. When composing modular documents, we want relative depths.

The coseoul package provides relative headings, but does not get things right when composing a document modularly from multiple parts. This package provides the missing piece.

modular relies on coseoul, import, and ifthen.

Bug trackerhttps://github.com/danielsank/tex-modular/issues
Version 2016-12-27
LicensesThe Project Public License 1.3
Copyright2017 Daniel Thomas Sank
MaintainerDaniel Thomas Sank
Contained inTeX Live as modular
MiKTeX as modular
TopicsFile control
See alsocoseoul
Guest Book Sitemap Contact Contact Author