Compose papers, dissertations, textbooks, novels, newspapers etc. quicker using abstractions to the standard LaTeX document classes - or create your own classes easily.
Check out LiX templates on Overleaf. Replace lix.sty
in your overleaf project with the latest one from here to apply updates. The same goes for document classes.
Lix is a meta-package which bundles other LaTeX packages and commands. To use these bundles, simply specify them when importing the LiX package, either in your own document-class, or directly in your main document when using a predefined class. The goal of this package is to speed up writing your documents, but also to simplify the process of defining your own class. Separation of layout and content is made much easier.
LiX aims to be for LaTeX, what LaTeX is for TeX.
Disclaimer: This project breaks conventions and practices, which are considered to be "standard" by the LaTeX community. If you want to learn "pure" LaTeX, this is not the project for you. However, for those of you that want to get stuff done as painlessly as possible: enjoy.
Shortcuts: Examples | Syntax | Installation | Scripts | Plans
Motivation:
While LaTeX is the indisputable king for typesetting publishable documents, it does have a steep learning curve and is very syntax-heavy. To ease the burden of typesetting and bring the author's focus back on their content, the syntax should be as light as possible. Defining your own look-and-feel is even more inaccessible, if one is not familiar with basic programming - hence this humble project, which attempts to address these issues.
All that can be achieved by this:
\documentclass{book}
\usepackage[stdclass, all]{lix}
\lang {danish}
\size {letter}
\cover {path/to/front.pdf}{path/to/back.pdf}
\margins {22mm}{20mm}{21mm}{40mm}
\title {A Cool Title}
\subtitle {And a Cool Subtitle}
\authors {Nicklas Vraa}{Another Guy}{And Another}
\date {01/01/2023}
\isbn {123456789}
\license {CC}{nc}{3.0}{My Company}
\edition {3}{2023}
\watermark {DRAFT}{black!10}
\begin{document}
% ... No need for \maketitle
\h{Introduction}
% ...
\code{my_snippet}{python}{
import numpy as np
% ...
}{This code does this and that...}
% ...
\fig{ny_figure}{0.8}{path/to/image.png}{This figures explains how...}
% ...
\end{document}
Imagine the LaTeX code, you would have to write to achieve the same - even when using appropriate packages. The layout of each element should be customized by defining a custom class that builds on top of one of the standard classes. Examples are shown later.
Advantages:
Disadvantages:
IEEEtran
class, as a reference for how to reimplement an existing look using LiX.Using this package, I've defined some custom classes, which are ready for use, as well as classes which mimic popular formats. Look at the source code for each class to see how easily they were defined. It's very simple to convert to another class, as they all share the exact same syntax. Download the pdf's to see the actual quality.
Paper (tex|pdf) packs as much information as possible, while adhering to the standards of academic research papers. | |||||
Novel (tex|pdf) is meant for fiction with the intent to print. This class supplies cover-, title- and metadata pages, etc. | |||||
Textbook (tex|pdf) is intended for typesetting a large amount of academic content to be printed in book form. | |||||
Novella (tex|pdf) is meant for short-stories with the intent to print. | |||||
News (tex|pdf) is designed as a classic newspaper akin to the The New York Times. | |||||
IEEE (tex|pdf) implements the IEEE journal and transactions template, but using LiX. | |||||
Contract (tex|pdf) is a simple template for a formal contract between an arbitrary number of parties. | |||||
Poem (tex|pdf) is a poem template that features a softer font and can optionally be decorated. |
Also check out:
It is also possible to use the standard classes, like article, report and book, but still benefits from simplified syntax. Simply import the package and specify the stdclass
option, along with any bundles, e.g.:
\documentclass{article}
\usepackage[stdclass, ...]{lix}
This is an overview of the commands, which are available when specifying a certain bundle (in alphabetical order). To those unfamiliar with LaTeX, a command is always prefixed with a backslash \
, mandatory input is enclosed in {}
and optional input is enclosed in []
. Whitespace between a command and its input does not matter. Comments are always prefixed with a percentage symbol %
. In-class commands are not supposed to be used in the main .tex
document, but rather in your .cls
file.
Insert algorithms into your document. Simply type your algorithm in plain text and mix in math typesetting whenever you require, between $
-signs. No need for any escaped \keywords
.
...
\algo{label}{
% Your algorithm.
% $some+math$
}{caption}
...
Algorithms will be subtly highlighted. A label is mandatory, but caption is optional. Indent the block four spaces, as these will be gobbled (removed) in the resulting pdf. This is for better readability in the source file. I recommend indenting all algorithms, tables, figures, etc., to better distinguish them from regular text.
A collection of essential commands and aliases.
\abstract{summary of findings}
\add{path/to/file.tex/pdf}
\input{}
, but also handles pdf files, which are inserted as pages. If starred, i.e. add*{}
, the given pdf will become the background of the current page.anchor{position}{...}
left
, right
or center
.\authors{first}{second}{...}{sixth}
\by{name}{email}{path/to/image.png}
\date{01/01/2023}
\idnum{123456789}
\keywords{this, that, ...}
\lang{language}{cus-tom, hyphena-tion, rules}
\subtitle{Some Buzzwords}
\title{A Catchy Title}
\toc
\url{text}{link}
\cols{n}{...}
\begin{columns}{n} ... \end{columns}
if \cols
doesn't work. \\watermark{Text}{color!opacity}
DRAFT
, or CONFIDENTIAL
with an optionally specified color and opacity, e.g. blue!100
. Defaults to gray!50
, if not specified.\shield{Text}{opacity}
\shield{COPYRIGHTED, NICE TRY}
.\np
and \bl
\newpage
and the second forces a blank line.In-class commands:
\authorfont{\...}
\use{pkg1, pkg2, ..., pkgN}
\wrap{prepend...}{append...}
Insert internal code blocks into your document.
...
\code{label}{language}{
% Your code.
}{caption}
...
Or import external code from a file using the starred version.
\code*{label}{language}{path/to/file}{caption}
Code-blocks will be subtly highlighted according to the given language. A label is mandatory, but caption is optional. For no highlighting, set the language to text
. For internal code block, indent the block four spaces, as these will be gobbled (removed) in the resulting pdf. This is for better readability in the source file. I recommend indenting all code-blocks, tables, figures, etc., to better distinguish them from regular text.
Add a cover to your document, as in the front and back of a book.
\cover{path/to/front.pdf}{path/to/back.pdf}
\begin{document}
.In-class commands:
\addFrontCover
\addBackCover
Place figures, i.e. images and illustrations in your document.
\fig{label}{scale}{path}{caption}
These command names were chosen to ensure that the readability of the source code is minimally affected.
\b{...}
(b)old text.\c{...}
(c)ode/mono inline.\i{...}
(i)talic text.\l{...}
(l)arge letter.\m{...}
(m)ath inline.\s{...}
(s)trikeout.\u{...}
(u)nderline.Add a strip of text to the top of each page.
\header{left}{center}{right}
Add headings to the document.
\h{...}
Level one heading.\hh{...}
Level two heading.\hhh{...}
Level three heading.\hhhh{...}
Level four heading.Top-level headings will act like chapters in book-like classes, but as sections in article-like classes. Headings will be numbered, unless a *
is added to the command, e.g. \h*{...}
. The regular commands, like \chapter
and \section
can still be used along with their starred counterparts.
\start{odd/even}
In-class commands:
addheadingseparator{type}
will separate numbering from the actual heading with either a line
or a final dot
after the number.Add an ISBN-code along with a corresponding barcode to your document. Should be called before \begin{document}
.
\isbn{978-0201529838}
Add a license to your document with an automatically generated copyright statement based on the input to the command. Should be called before \begin{document}
.
\license{type}{modifiers}{version}{holder}
Types | Modifiers | Versions |
---|---|---|
Creative Commons: CC |
Attribution: by ShareAlike: sa NoDerivatives: nd NonCommercial: nc |
Universal: 1.0 Unported: 3.0 International: 4.0 |
Add lists to your document. It is possible to nest lists.
\items{
\item Something
\item Another thing.
\items*{
\item Something else
\item The final thing.
}
}
items{...}
will be numbered, and items*{...}
will be bullet points.
Add math-blocks to your document.
\math{label}{
% Regular latex math.
}
The label is required and the math block will be numbered. These are shortcut commands in the math environment:
\mean{x}
$\rightarrow \overline{x}$\Re
$\rightarrow \mathbb{R}$ (Real set)\Im
$\rightarrow \mathbb{I}$ (Imaginary set)\N
$\rightarrow \mathbb{N}$ (Natural set)\Z
$\rightarrow \mathbb{Z}$ (Integer set)\Q
$\rightarrow \mathbb{Q}$ (Rational set)\C
$\rightarrow \mathbb{C}$ (Complex set)\epsilon
$\rightarrow \varepsilon$ (varepsilon)If this bundle is loaded, it will automatically fill in the metadata fields of the pdf, like the title, subject, keywords etc.
Add various elements relating to documents that are periodicals, like a newspaper. Should be called before \begin{document}
.
\cost{\$9.99}
\issue{123}
\location{Copenhagen}
\volume{123}
Add various elements relating to documents that are published in book-form, like a novel. Should be called before \begin{document}
.
\dedicate{dedicatee}{message}
\edition{123}{year}
\note{longer author's note}
\publisher{your publishing company}
\thank{people or organizations}
\epigraph{poem or quotation}
\endpages{N}{M}
In-class commands (for creating custom classes): \addFrontCover
, \addBackCover
, \addFormalPage
, \addCorners
, \addBorders
, \addEpigraph
, \addBlanks
.
Add ornamental elements all pages of the document. Browse the types of ornaments are available in the documentation for the pgfornaments
package. Check out the poem class for a visual example.
\corners{ornament_id}{color!opacity}{width}{padding}
\borders{ornament_id}{color!opacity}{width}{padding}
Reference internal elements and cite external sources from your bibliography.
\at{label}
\At{label}
\cite{your_source}
\bib{path/to/refs}{style}
abbrv
, acm
, alpha
, apalike
, ieeetr
, plain
, siam
, unsrt
unsrt
(in order of appearance). .bib
extension when specifying the path. *
to the command, i.e. \bib*{...}
will print the entire given bibliography, regardless of whether entries have been explicitly referenced in your document.In-class commands:
\bibfont{\...}
Place signature fields in your document.
sign{name}{designation}
These are commands for setting up the basic layout characteristics of your document. Should be called before \begin{document}
.
\size{standard}{orientation}
ISO-A | ISO-B | ISO-C | ANSI | US | Orientation |
---|---|---|---|---|---|
a0 a1 ... a6 |
b0 b1 ... b6 |
c0 c1 ... c6 |
ansia ansib ... ansie |
letter executive legal |
portrait landscape |
\size{custom}{width}{height}
, e.g. \size{custom}{6in}{9in}
.\margins{top}{bot}{inner}{outer}
{all}
, {topbot}{innerouter}
, {top}{bot}{innerouter}
. When doing double-sided printing, the inner margin is often wider than the outer margin to allow for space to bind pages together. For single-sided printing and digital-only documents, the inner and outer margins are almost always equal.There are three types. These three tables will cover 90% of your table-needs, but you have access to the full power of the tabularray package for more complicated tables. The &
symbol separates items and \\
separates rows. Caption is optional.
\tabs{label}{type}{
% Your table content.
}{caption}
Types:
cols
: Classic table, the top row acts as the header.rows
: The left-most column acts as the header.grid
: Both the top row and left-most column act as headers.Formatting code for the table may also be given explicitly in the type field.
The LiX package and all classes work out-of-the-box with Overleaf. Simply include lix.sty
and the appropriate .cls
file in your project folder.
If you are working locally, you need to have all package dependencies installed. Depending on which bundles are imported and what class is in use, LiX may import the following packages:
amsfonts, amsmath, amssymb, babel, caption, cite, doclicense, ebgaramond, enumitem, esint, eso-pic,, fancyhdr, float, fontenc, geometry, gothic, graphicx, GS1, hyperref, inconsolata, inputenc, lastpage, lettrine, lipsum, listings, microtype, multicol, numspell, parskip, pgfornaments, setspace, silence, siunitx, svg, tabularray, titlesec, titletoc, titling, tocbibind, ulem, xcolor, xparse, yfonts
Check up on the svg package, which has non-latex dependencies. If you have svg's included in your document, the compiler has to be run with the argument: --shell-escape
.
For VSCode, I recommend installing the LaTeX Workshop extension, and adding this snippet file to your snippets collection, and this entry to your own settings.json
file.
The following are bash commands that call scripts which are particularly useful for self-publishing and book production.
Encrypt and protect your PDF with a user- and owner-password for more secure distribution. Supply passwords and paths to source and destination. Requires qpdf
.
qpdf --encrypt <userpass> <ownerpass> 256 --modify=none --extract=n --print=none -- <source>.pdf <dest>.pdf
Prepare your PDF for book-style printing by performing automatic imposition. Supply the number of pages per signature N
, the sheet dimensions, and paths to source and destination. Requires pdfjam
.
pdfjam --nup 2x1 --signature <N> --frame false --twoside --trim '0cm 0cm 0cm 0cm' --clip true --quiet --keepinfo --papersize '{<height>,<2*width>}' --tidy --landscape --longedge --outfile <dest>.pdf <source>.pdf
LiX package:
\authors
command to ensure proper formatting of multiline input.|
instead of &
.\tabs
.\toc
for specifying sorting order.Classes:
Additional:
LEGAL NOTICE: This repository, including any and all of its forks and derivatives, may NOT be used in the development or training of any machine learning model of any kind, without the explicit permission of the owner of the original repository.