Sutra Styles

I’ve been messing about with typesetting Buddhist Sutras in Japanese, inspired by @RoseWagsBlue and her scholarly and typesetting projects. What started as a fix for one file has become a collection of LaTeX code that makes typesetting your favorite Japanese text easy. I hope so anyway.

Here is the project in its latest stage. I’d love feedback, bug reports, comments, etc.

ジョージ

3 Likes

I am going to have some hints for you. In the past, I have typeset vertical text by other methods than multicol…

Looking back through documents, I have things like this:

\newcommand{\yojipage}[1]
{
\newpage
\fontsize{24}{24}
\begin{center}
\rotatebox{-90}{
\begin{minipage}{0.95\textwidth}
\CJKfamily{cjk-vert}
#1\
\end{minipage}
}
\end{center}
}

In isolation this code does not mean much, it is just a way I found to rotate a single little page with a line of kanji.

Also, you need clever ways to rotate the character “–”, (ichi) which appears quite frequently. I seem to recall some documentation for xeCJK that is in Chinese, but can be deciphered with effort.
Also, there are a few other \LaTeX heads here.

Here is a workaround in isolation:

\newcommand{\stick}{\scalebox{-1}[1]{\rotatebox[origin=tr]{90}{ー}\hspace{0.75em}}}

I used this to rotate ichis. Where there is an ichi in your doc, you just use the command \stick. I don’t know how I came up with the 0.75em hspace. Maybe I should document better!

1 Like

Oh is that what the stick command is for… It makes lots of sense now. I’ll use it!

So far I think multicol works really well. And now that I figured out how to add chunks of text all at once, the job of typesetting has become easy. One can easily change column numbers and font sizes to get the spacings right.

1 Like

Updated things. What do you think now? Are the ichi’s properly rotated?

1 Like

Nice ichis, dude!
Actually, your documents look real sharp how they are set up.
If you need a challenge, you could use some code to set the desired number of characters in each column, and the code would calculate the right size of text so that it would fit. :slight_smile:

Actually, what I will do soon is use the Styles to lay out a few pages, and then suggest some new features. I never wrote a Style or a Package, so I am now envious.

I have always intended to make a little package for making multifolded booklets with Japanese and English text. I have a nice system for putting them together, but I just want to make a final reproducible version of it.

Scroll down a little on that thread and you will see the finished and bound result. Another user even bound one too!

1 Like

Not rotated properly here! :frowning:

Very confuse! Tex wut?

Should it be centered? Was that the function of the 0.75 em (I took that out and fiddled around with position parameters to not much avail)? Is there any way to use your \stick command to push the uchi arbitrary distances to the left?

1 Like

Ok So I think it fixed the spacing of the ichis.

As for packages and such, I have never really built one before. I am trying to stick to ideas of modular design and not repeating myself, but beyond that I am making things up as I go, so any ideas or strategic advice would be appreciated. I think the next step should be to organize the already burgeoning code. I think examples can be shortened, moved aside and automated as a next step. And then finally the whole things should probably be rewritten as a LaTeX .sty file I imagine. That will be a fun thing to figure out how to do!

1 Like

It’s now officially a LaTeX package called sutras.sty.

1 Like

Thank goodness! I couldn’t sleep worrying about those uncentered ichis. I will look at the code a bit. Maybe this will push me to finally write my own package of some kind.

Now I have looked though the .sty code. Simple, nice, functional. I like. Good work!
Also, you took enough care to fix things like turning a しゅ to a しゅう in my sloppy work.

1 Like

Was lucky I caught that missing う

Thanks for the kind words! I redid the \haiku \compactVerse and \spacedVerse commands to make them easier to use. You don’t need a comma separated list of characters any more but can enter a string, with the possibility of grouping them as well like so {ab}.

\begin{multicols}{7}
	\RLmulticolcolumns
	\compactVerse{%
		般若心經ロ\stick マ字佛説摩訶般若波羅蜜多心經観自在菩薩行深般若波羅蜜多時照見五蘊皆空度 \stick 切苦厄
	}
\end{multicols}

https://gwmatthews.github.io/verse-test.pdf

1 Like

I have a quicker way to do this. You just use \raggedcolumns attached to the \RLmulticolumns – that allows for variable length columns. Then you use an individual \haiku{} group for each coulumn’s set, separated by \columnbreak

\renewcommand{\kanji}{\centering\fontsize{35}{35}}
	\begin{multicols}{4}
		\RLmulticolcolumns\raggedcolumns
		
		\haiku{古池や}
		\columnbreak
		\haiku{蛙飛び込む}
		\columnbreak
		\haiku{水の音}
		\columnbreak
		\haiku{\coda{ 芭蕉 }\coda}
			
	\end{multicols}

This is the famous Basho haiku about the frog and the pond. The last two characters are his name kanji, so they are typeset to appear side by side, with a dot before and after.

1 Like

You have inspired me to work on a style for my books of 四字熟語. Somewhat backwardsly, I can never get LaTeX typesetting to work on my linux laptop, but I have no problem on my windows desktop. But my back gets sore in front of that computer, so that limits my time working on it (which is good, I suppose).

For your code, I would like to see you further abstract the whole process. In other words, instead of a renewcommand, the command would accept more options and variables. You have abstracted much of it already.

I am going to go log into my other computer and send myself some documents, so that I can work on this computer! I really need to get LaTeX set up right on this.

Well good for you and I look forward to seeing those books!

Just so you know, I modularized things so now it should be easy add new texts. So far I have files in the /texts subdirectory with titles such as four-vows-compact.tex or heart-sutra-tracing.tex that are basically pre-formatted chunks of text that can be inserted into a document with a simple input{../texts/heart-sutra-compact} command.

Things are improving! And if you have more texts to contribute, with or without readings, have a look in the /texts folder for what they look like.

Linux and LaTeX play together just fine on my laptop! For what it’s worth, I installed LaTeX in this machine in a stripped down way to avoid the bloat that I used to have with it (Linux MInt 20 xfce version on a Lenovo Y700). This time I around I installed it via RStudio (used for other projects), and in particular using the rstudio tinytex package. It is trimmed down but also installs things in a way that I don’t need to be root to install new packages as needed. Other than that it is just occasional tlmgr install package when I need things,

1 Like

You need to do a Japanese Lorum Ipsum with it. :slight_smile:

That’s what the 4 vows and the heart sutra have become!

1 Like

And speaking of the heart sutra… let me know if you see any mistakes. And yes other fonts are possible.

Here’s the entire source code for the document:

%  Typeset  sutras for tracing, reading, chanting

\documentclass[letterpaper]{article}
\usepackage[left=2cm, right=2cm, top=0.3cm, bottom=0.3cm]{geometry}

\usepackage{sutras}
%%% CHOICE OF FONTS
 
%\setCJKmainfont{KanjiStrokeOrders}  %% for tracing 
%\setCJKmainfont{ipam.ttf}  %% serif
%\setCJKmainfont{ipaexm.ttf}  %% serif
\setCJKmainfont{ipag.ttf}  %% sans
%\setCJKmainfont{ipamp.ttf}  %% sans
%\setCJKmainfont{ipaexg.ttf}  %% sans
%\setCJKmainfont{YOzM90.ttf}  %% calligraphic
%\setCJKmainfont{Harano Aji Mincho SemiBold}  %% calligraphic
%\setCJKmainfont{KouzanGyoushoOTF.otf}  %% calligraphic

%%%%%%%
%%%%%% END PREAMBLE
%%%%%%%

\begin{document}
	
	\input{../texts/heart-sutra-annotated.tex}
	
\end{document}


1 Like

I need to apologize. I am such a total doofus.
I some how got this thing about rotating ichis. And I have sometimes seen text with them rotated.
But they are not usually rotated, and they certainly don’t need to be.
I was corrected here on WK, and then looked through some books.
I don’t know how I ever got the idea in my head. But I am glad I have fixed it.
In the meanwhile, I have spread my faulty knowledge on to you. :frowning:
I am so sorry for that. But it can all be fixed. :slight_smile:

Haha, thanks for letting me know! I had no idea about them being a beginning Japanese reader, but figured, sure why not, maybe there is a taboo about covering things with sticks in Japan. It’s a simple fix – find and replace \stick with 一. Now I just have to issue a recall and second edition notice to all of the myriads of people who downloaded the whole heart sutra and were happily tracing it out, vertical lines and all :frowning:

1 Like

This is a lesson about how something totally wrong can get stuck in a person’s head. I cannot now remember how I picked the idea up. And yet, in any text I read, the ichis are clearly horizontal. You have my deepest apologies for passing this wrong information on to you.

This is a lesson that I will remember.