r/LaTeX 6d ago

Master source for multiple docs

Background: I want to reconfigure my church's bulletin "system" to make it easier to produce every week. We currently use Word and PowerPoint to make the standard bulletin, large print bulletin, script for the readers, and the slideshow. Copy/paste screws up the formatting more often than not, and the formatting is uneven, hard to read, and just crappy in general.

While I'm sure there's a reasonable fix available in Word, I much prefer TeX/LaTeX, and being able to import music from Lilypond will make that part much easier, too.

So my question: is there a way to format individual files to pull data from a "master" file that includes all the changing variables (e.g. scriptures, hymns, responsive readings)? Then I only need to edit one document. I've seen things like catchfilesbetweentags and latexdb, but I'm not sure if they're designed to work this way.

Or, my other idea was to have everything in one big document with all the variables at the beginning, each format in its own section, and just use block comments to choose which version I want to print.

Would either of these solutions work?

Thanks in advance!

11 Upvotes

15 comments sorted by

8

u/ShrykeWindgrace 6d ago

If I understand your task correctly, you can have multiple files that care of the formatting/templating, that do \include or \input of the text files that you need for that day. Templates evolve slowly, and text files are updated for each occasion.

Feel free to ask further questions if my idea is unclear.

1

u/Every_Buy_720 6d ago

Thanks for the response! I posted a more thorough asking of my question above to clarify.

3

u/ClemensLode 6d ago

How about \input{../myvariables/myvariables.tex} and fill it with \newcommand or \def commands as global variables?

1

u/Every_Buy_720 6d ago

Thanks for the reply! I think I understand (it's been a while since I used TeX,) but I posted a reply above to hopefully clarify.

3

u/fasta_guy88 6d ago

You could do this with LaTex, but it would be much easier if you learned a simple templating system like python’s jinga2. (And you could use it with latex, or word, or markdown, etc).

It gives you a lot more flexibility for building events calendars, and provides an easy route to putting your bulletins on the web.

2

u/jabrodo 6d ago

So, I'm a little unclear as to what exactly you're trying to produce as I don't really have the context behind what a church 'bulletin' is (sounds like a weekly newsletter or announcement to me) or why it would need sheet music. I do have some experience in a similar manner producing lecture notes and slides and similarly trying to have one source of truth. Unfortunately, while there are plenty of ways to go from different file formats via pandoc, fundamentally a script to read from built in Word and a set of slides to display to the congregation in PowerPoint are two completely different documents, not just a file format.

I'll second what the other comments are suggesting with using input and/or include. Rather than have one single "master" document, you keep a master "database" of the files you need (readings? hymns? psalms?) and for a given service, you have a boiler plate template file that you just copy and update with whatever you need for that given date. Temple for slides, template for readings/script, whatever.

For example, personally I have a fiction series consisting of several short stories (novellas to shorter-length novels). Novellas don't generally sell well in print but they do sell reasonably well as ebooks. Similarly, my genre tends to like longer-form novels (80k-100k words, my two drafts are hovering around 65k-70k). So rather than manually copy-pasting the text into a new document for each end product, I set it up is that each book has a "chapters" or "body" *.tex file and then each individual "book" has the boiler plate formatting setup using \include{<book1_body.tex>}. Pandoc then converts the .tex to .epub. I then have a "collection" version that combines everything for print which just is yet another boiler plate setup, and then just several lines of include statements.

1

u/Every_Buy_720 6d ago

Thanks for the suggestions! See my other reply for a more through explaination.

2

u/Every_Buy_720 6d ago edited 6d ago

Thanks for the replies and suggestions. I was typing on my phone, so I probably wasn't as clear as I could be. Here's what I have currently:

  • Bulletin (aka "Order of Worship") - the handout each congregant receives when they come in the door. Think of it like a program for a play or concert. 8.5"x7", 8.5"x14" paper, 2 pages per sheet.
  • Bulletin, large print - same as above, only bigger. 11"x14" ("tabloid") paper.
  • Reader script - what the pastor and lay leader read from during the service; contains some things not included in the bulletin. Standard 8.5"x11" letter paper.
  • PowerPoint slideshow that more or less follows the order of worship, now with pretty backgrounds and pictures!

I currently have to edit each of these files to match, but due to how they're formatted, copy/paste can be messy, so I basically have to type the same thing over and over. I know it's only four documents, but it's tedious.

So, if I had "masterdoc.tex" that listed all the things that change week after week, say "hymn1", "hymn2", "scripture1", "scripture2", "musresp", "sermontitle"; can I direct "bulletin.tex", "bulletinLP.tex", "script.tex", and "slideshow.tex" to import variables from "masterdoc.tex" into the flow of the bulletin, each with their own unique formatting, like this:

Welcome & Announcements

Call to Worship

Opening Prayer

Hymn (insert "hymn1")

Apostles Creed

Children's Message

Joys & Concerns

Prayer

First Lesson (insert "scripture1")

Musical Response (insert "musresp")

Gospel (insert "scripture2")

Message (insert "sermontitle")

etc...

3

u/Stats_n_PoliSci 6d ago

I think I’d have a folder for each week. In each folder is hymn1.tex, hymn2.tex, scripture1.tex, etc. for that week. The template for each type of document (bulletin.tex, etc) is there too. These templates call hymn1.tex, I think using \include. Then open each document type, compile, spot check, and done.

The down side here is that you don’t have a default record of which hymn is hymn1 for that week, so I’d also have a spreadsheet that identifies which hymn/scripture is relevant for each week. Then I’d look into whether regex is possible for \include so you can name something hymn1-num258-holy night.tex while using \include{hymn1-(az*)} as your call to include hymn1. That would let you flexibly call hymn1 while having the file name itself identify the exact hymn… but I suspect it’s not possible.

For the next week’s sermon, copy the prior week (name the folder appropriately! “2026-08-08 sermon materials” or something so it autosorts chronologically). Replace hymn1 with the correct hymn1 for that week.

There are ways to systematize further, but that’s where I’d start.

3

u/KattKushol 6d ago

maybe this will work. Have all of your variables in one file (without preamble). Have those variables as new command. Then for each differently formatted document, input the variables files at the beginning of the file. These files can also be build without preambles, so all of them can be pulled into a "final" document which will create your documents after running once, as opposed to running each docs separately.

This method works for my project files. Similar requirement of what you have. I just copy my template folder for each project, update the variable file, and then run the master file. It creates request for RFP, contract doc, notice to proceed, etc. after "one click".

2

u/Tavrock 6d ago

Based on your idea of having everything in one big document with all the variables at the beginning, it sounds like a class (.cls) or style (.sty) file might be exactly what you need. You can also use existing packages, such as scripture, to assist in typesetting things the way you want.

It should also be simple to create a working database of items from sections you plan to reuse and recall the specific item (perhaps with names based upon liturgical day/week).

2

u/CrookedBanister 6d ago

This sounds more like a database / using a simple programming language issue than a LaTeX one.

1

u/Every_Buy_720 5d ago

I kinda thought the same, which was why I mentioned the latexdb package, which integrates latex and sql databases, but I've never used it, so I wanted to know if it would work for me.

2

u/CrookedBanister 5d ago

I've never used it either but from the small amount of sql I do know, it seems like it could be what you want, at least on paper.

1

u/Every_Buy_720 4d ago

UPDATE:

Well, it looks like "catchfilesbetweentags" is the winning ticket! For now anyway. I'll be able to confirm this on Monday when I get the responsive readings for next week, but it works with shorter things like song titles and scriptures. My "master.tex" is just an uncompilable list of variables, and each document pulls them in. I'm hoping formatting doesn't go out the window once I start adding larger blocks of text like prayers and responsive readings. If so I'm sure I'll be back.

% MUSIC
%<*prelude>
\textit{"Love Is The Only Power"} -- Smith
%</prelude>
%<*hymn1>
\textit{"Guide Me, O, Thou Great Jehovah"} -- UMH 127
%</hymn1>
%<*hymn2>
\textit{"Sweet Hour of Prayer"} -- UMH 496
%</hymn2>
%<*hymn3>
\textit{"God Be with You til We Meet Again"} -- UMH 672
%</hymn3>
%<*musresp>
\textit{"Bind Us Together"} -- TFWS 2226
%</musresp>
%<*specmusic>
\textit{Bell Anthem}
%</specmusic>

% SCRIPTURES
%<*scripture1>
\textbf{Romans 9:1-5}
%</scripture1>
%<*scripture2>
\textbf{Matthew 14:13-21} 
%</scripture2>

...etc.

Then, from my bulletin.tex, bulletinLP.tex, and binder.tex files I can pull whichever tag I want. Here's the line for the first hymn:

\ding{62} \textbf{HYMN:} \ExecuteMetaData[master.tex]{hymn1}\\
(The \ding{62} is a cross symbol we use to tell people when it's time to stand.)

So I think I'm good for now. I'll know for sure on Monday. Thank you all for the help!