6

This question led to a new package:
scrjrnl

I'm searching for packages to write a daily devotional such as this one (Click "Search inside this book" and see in the end of the preview for example). I could not find a suitable package on the CTAN to do that.

I'm thinking that I could use a book or scrbook class and either redefine or encapsulate:

  • \chapter for each month, resetting a counter for every day;
  • \section for every day of the month, using and incrementing the counter.

What would be the best/easiest approach in this case?

  • Making a devotional class to replace book;
  • Writing macros to encapsulate \chapter and \section;
  • Redefining \chapter and \section or playing with definitions used inside \chapter and \section calls in book or scrbook;
  • Any other enlightened suggestion...

The usage I'm thinking about would look like this:

\documentclass{scrbook} % or \documentclass{devotional}
\begin{document}
\tableofcontents

\month{January} % Set counter for month of January
\day*{} % Set a new day -- January 1, do not list in toc
\begin{verse}{Genesis 3.4}
% contents of the verse
\end{verse}
% commentary
% commentary
\begin{prayer}
% contents of prayer
\end{prayer}

\day*{} % Set a new day -- January 2, do not list in toc
% day contents

% etc.
\end{document}
raphink
  • 31,894

1 Answers1

6

Before you think of implementation, spend some time thinking of the structural and semantic elements of the book. From the example, I would structure the document as follows:

Structure

-- Collection
---- Devotional
------ Title
------ EpigraphTop
------ EpigraphBottom
------ Body
--------- Quote
--------- text
------- PresentationDate

By abstracting the sectioning elements a collection can represent a month or a week, if you wish. A devotional can represent daily text as requested or weekly chunks.

Author Commands

The next step would be to design the author interface. I would aim for:

\collection{January}
    \devotional
    \epigraph{...}
    \epigraph{...}
    body............
    ................
    \Quote{}
    ..............
    .............
    \enddevotional

Implementation

Alias : Chapter -> Collection
        Section -> Devotional

I would use the basic book class and create a package to handle the code. Use TikZ to draw the fancy boxes and the month marker at the beginning of the month at the upper right hand part of the page.

One of the difficulties I see here, is to get the right amount of words to fit everything per page. If you know TeX well, you might decide to make the body, as one command that you can box, measure it and unbox it to assist you writing the book. A good text processor that can count words might also be helpful.

yannisl
  • 117,160
  • Thank you. I've never made a package, and my TeX skills are quite limited. I see this as an opportunity to learn quite a lot, although that's quite a big step forward for me... – raphink Apr 10 '11 at 20:49
  • @Raphink Go one step at a time. Don't worry too much about looks at the beginning. Rather focus on the write-up. Do incremental improvements, for example start defining the epigraphs first. Whatever you need it has already been covered around here. If you get stuck, post a question or come over to chat and ask it. Good luck. – yannisl Apr 10 '11 at 21:14
  • Do you know a good tutorial to get started with that kind of package writing? – raphink Apr 10 '11 at 21:23
  • @Raphink Have a look at this http://tex.stackexchange.com/questions/tagged/package-writing – yannisl Apr 10 '11 at 21:28
  • @Raphink Yiannis's advice is very good. I would recommend basing your package/class on the memoir class or scrbook rather than the regular book class, though. (I'm partial to memoir because the documentation is exemplary.) – Alan Munn Apr 10 '11 at 21:33
  • @Yiannis Thank you. I've seen people writing packages in Perl and then using makedtx, and then docstrip. Is that a recommended way of doing it? – raphink Apr 10 '11 at 21:33
  • @Alan I'm thinking of going with scrbook as a matter of fact, I've been converted to koma already. But then if I can do a package that is compatible with book too, it would be ever better. – raphink Apr 10 '11 at 21:35
  • 1
    @Raphink I wouldn't recommend Perl for this. It will make it more difficult. – yannisl Apr 10 '11 at 21:38
  • @Yiannis Well I know Perl much better than I know TeX, so I freak out far less when I see Perl code... that said, I would probably learn much more from coding directly in TeX... – raphink Apr 10 '11 at 21:40
  • @Raphink If you're aiming at a package and not a class, then I would do most of the work with the titlesec package, which allows you to create any sort of sectioning system you like. If you build things based on either scrbook or memoir you'll be somewhat more restricted to those classes. But if you make it a class, that's less of a problem, since it can be based on one of them. It also depends on how wide an audience you may be aiming for. – Alan Munn Apr 10 '11 at 21:40
  • @Raphink Alan's advice is also good. See also this post http://tex.stackexchange.com/questions/11444/how-to-format-the-chapter-heading it is not far off from what you want to do and there are examples using LaTeX code straight or titlesec. – yannisl Apr 10 '11 at 21:50
  • @Yianni: when you say to use tikz for the boxes, do you mean to use the box facility of tikz or draw from scratch? Do you have an example of such boxes? – raphink Apr 12 '11 at 11:41
  • @Raphink I don't have an example and TikZ is not my forte, post it as a question we have some people around that are very strong in this sort of thing. – yannisl Apr 12 '11 at 17:37