Coder Social home page Coder Social logo

thecomamba / loretex Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 474 KB

LoreTex is an extension to the Tex language for compiling pdf documents, providing an interface to define characters, places and more, and then generate a glossary containing those entities that are relevant to your story.

License: MIT License

Lua 89.66% TeX 9.03% Batchfile 0.52% Shell 0.78%
latex pen-and-paper rpg tex world-building

loretex's Introduction

Contributor Covenant

LoreTex

Have you ever struggled to keep your adventure notes organised? Did you copy and paste parts of your lore to different adventures set in the same world and then they ran out of sync? Do you wish to give your players an up-to-date handout but not reveal your secret details?

LoreTex may not be the answer to these problems, but it is my answer. It is an extension to the Tex language for compiling pdf documents, providing an interface to define characters, places and more, and then generate a glossary containing those entities that are relevant to your story.

Setup

Prerequisites

LoreTex assumes that you have the LuaLaTex compiler installed.

All required Tex packages are included at the beginning of main.tex. Currently, these are luacode and nameref.

Installation [Outdated!!!]

Clone this git repository to some place on your computer:

git clone https://github.com/TheComamba/LoreTex.git

Alternatively copy the contents of this repository to some place on your computer.

LoreTex uses the Lua scripting language, and can thus only be compiled using LuaLaTex. It further needs to load a library, which due to security reasons is only possible in shell-escape mode. Hence, to compile from a terminal you need to call:

lualatex -shell-escape <your tex document>

If you're running from a GUI that supports "magic comments"/"advanced headers", you can add the line

% !TeX TXS-program:compile = txs:///lualatex/{%.tex} -shell-escape "%.tex"

to your document.

(Note that this contains a bit of a hack, see this discussion.)

A note on security:

In principle, you could set your default compiler to the value provided above. Do not do this! This allows the execution of basically arbitrary code once you hit compile.

Usage

The tex file using LoreTex needs to be told where to find main.tex:

\documentclass{book/memoir}

...

\input{some/relative/path/to/main.tex}
\loadLuacode{some/relative/path/to/}

...

\begin{document}

A good place to start is the tutorials folder.

Contributing

Merge requests are welcome.

Please follow the gitflow naming convention of prefixing branches with "bugfix/" or "feature/". Currently I see no reason for a separate develop branch.

For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update the tests as appropriate.

Criticism of the coding style is very welcome. I find it tough to write clean code in Lua, and I am eager to improve.

And, of course, you are asked to comply with the code of conduct.

License

This software is distributed under the MIT license. In a nutshell this means that all code is made public, and you are free to use it without any charge.

loretex's People

Contributors

simonheidrich avatar thecomamba avatar

Watchers

 avatar  avatar

loretex's Issues

Auto generated calendars

Using the information of months we can print out a table with an entry for every day (or maybe some smarter version of a calendar).

We could also define a new chronologies type named "holidays", which are automatically added to their affiliated calendars.

Maybe change history latex commands.

To \birth, \death and \ignore.
Currently we have the latex command \birthof, which has a different casing than the protected descriptor birthOf.

Lifestages are added to sub-entities as well

Repro Steps:
1.: Create a new entity.
2.: Add a birth event by calling the \born{} command.
3.: Give the entity a species that exists and ages.
4.: Add a descriptor with a labeled subparagrah.

Make sorting in lists configurable

Currently, affiliated entities are sorted alphanumerically. This is probably useful for most cases, but not all. Take, for example, a dynasty that lists all its rulers. Here I'd like chronological sorting (Henry VIII before Elizabeth II).

One possible solution is to add a protected descriptor "sorting" to entities, which contains either an empty string or another protected descriptor, by which affiliated entities are sorted. One drwaback is that currently not all contents of protected descriptors are sortable. For example, sorting by the role of an affiliation member is not directly possible with this setup.

More thoughts required!

Create an example adventure document

Ideally this should contain at least one usage of every TexApi function.
Maybe we can add the usage measurement currently only used in the tests to the Debug namespace and thus check which Api functions are not yet used.

This document should also be compiled by the pipeline scripts.

Make location captions point to their description

At the moment the captions for entities which sort them by location are generated from the location's shortnames. It would be nice to have some link to the location. One solution would be to use nameref commands instead of the shortname in the caption, but then the shortname in the optional argument of the caption (otherwise the table of contents contains links in links, which screws it up.)

Another solution would be to add a "Compare \nameref{some-location}." between header and entity.

Both solutions only make much sense if the locations are primary refs, and not only mentioned.

Make some historyItems full-fledged entities

They then contain a label. These entities could even contain sub-history items. This might be useful for important events lasting several days.

Maybe we need a new chronologies type for this feature.

Remove setDefaultLocation

Print warning if an entity has no location set.
Setting location explicitly to empty string is ok, because some top-level entities have no location.

Implement Dictionaries

A little code for this feature already exists in the file dictionary.lua, from the time before feature branches and pull requests.

It would nice to give RpgTex a table input and have it print that table in a user defined version. For example, you can give it a dictionary for a fictional language containing the columns "English", "Grey Elvish", "Elvish Spelling" and "Pronounciation", and then make it print the table in that column order, with rows sorted alphanumerically by the "English" column, and then print it again with only the columns "Grey Elvish" and "English", rows sorted by the (now) first column.

Make DebugPrint multiline

Analogous to test code.

grep for LogError and DebugPrint, needs to become a table, otherwise we try to concat strings with tables.

Support SQL Databases?

Managing around a thousand entities is quite annoying when they are sorted in files. I often find myself using grep to find out what file a specific entity is defined in.
It would be much cooler to store all my entities in a database, with a small GUI to access it. It should contain a search field, and maybe some checkboxes generated from the content (e.g. "show me only entities of type npc").

Do we even need metatypes?

Or could we just print one chapter per type?
Then we could remove the need to declare types beforehand - they are just deduced from the types that appear in entities.

Temperature gradients

A list which stores "day of year" and associated "average temperature". If the current day is globally set, we can linearly interpolate between the points to display the expected current temperature.

Error with secret history

Adding a secret history item and then a non secret history item, and then printing without secrets, the date is not shown.

Offer option to use Python instead of LuaLaTex

Prerequisite: #32

Python can generate PDF documents as well. This would create another channel for users to access the functionality.

In that case the repo should probably be split up into LoreTex, LorePy, and a subrepo containing the rust code.

Properties for Descriptors

Now that descriptors can be sub-entities, they could for example be secret, have their own association, their own ageFactor, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.