10

Tibetan Pecha

I am delighted to see how well XeLaTeX can handle Tibetan script and want to use it for the typesetting engine for my software.

The first thing I want to do is to create a simple documentclass, with the certain rules I shall describe below. I have included a picture with colour coded rectangles to show what I need to do.

  • First of all I need each page of the document properly aligned so that for an A4/legal sized paper page, the text boxes are printed on the exact place on both sides of the paper. The back side of the paper needs to be flipped upside down, since traditional Tibetan manuscripts are turned on the horizontal axis, whereas Western books are turned on the vertical axis. For A4/legal size paper, there should be a single Tibetan page centered on each side of the paper, but an A3 sized paper should have two Tibetan pages on each side of the paper sheet in order to not waste paper.

  • the pages must be in landscape orientation.

  • Each Tibetan page should have three text boxes as one can see on the image: The box to the far left (yellow and purple) is rotated 90 degree clockwise, but the one to the far right (orange) is rotated 90 degrees counter clockwise.

  • The text box marked with purple is the title of the manuscript and should be printed on every even numbered page.

  • The text box marked with red, shows some characters that can be represented with Unicode and should be printed on every odd numbered page as well as on title pages. It should be followed by a long blank space, marked by the blue rectangle.

  • Each stanza is normally marked with vertical lines. These lines have spaces in between them (green rectangle), but these spaces can vary in length depending on certain circumstances. Looking at the light blue rectangles on both the top page and the bottom page, the top one is a bit shorter due to the line breaking. This word consists of two columns, while the word marked by the bottom light blue rectangle only has one column, hence allowing a full length space between the vertical bars separating the stanzas.

I mainly need your help to learn how to create the framed text boxes that have a fixed position on the printed page, with the text box on the backside of the paper sheet being printed upside down. However, any other tips with regards to what I'm trying to accomplish is greatly appreciated.

  • 1
    Creating a new document class is more work than you need, especially for a beginner. The easiest way to reuse formatting commands is to put them into a separate .tex file and use \input in the preamble (before \begin{document}). Also, check out the flowfram package. – John Kormylo Jun 10 '14 at 14:01
  • How can I make it so that my document starts with one page of a certain environment, like the example you provided in your answer, but then have other environment for the rest of the document? Your example below is only supposed to be used for the title page, so I need to be able to switch environments depending on the context. How is it possible to do this? – jollyroger Jun 19 '14 at 12:58
  • 1
    You can specify the page or range of pages for each frame. So you need one set of frames for page 1, another set of frames for page 2, and a third set of frames for the remaining pages. – John Kormylo Jun 19 '14 at 13:21
  • If you mean the contents of the dynamic frame which appear on the left and right sides, you can use macros (like \thepage). Every time you want to change the contents, change the macro definition. IIRC, changes will not appear until the next page. – John Kormylo Jun 19 '14 at 14:23
  • 1
    This is all very much possible with TeX, and no you don't need to insert page breaks manually. I just answered a similar question earlier today and this is not much harder to do either. I also just now noticed there exists a package called pecha. I can post it as an answer if you want. – ShreevatsaR Apr 22 '17 at 4:18
7

Ultimately, you are going to have to manually add page breaks. I have added a few commands to help. \pagepar is used to break a page between paragraphs, and \pagenopar to break a page in the middle of a paragraph. Both accept a character or box to place in the lower right corner.

\documentclass{article}
\usepackage{geometry}
\usepackage{flowfram}
\usepackage{shapepar}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{mwe}

\geometry{paperwidth=29.7cm,paperheight=7cm,margin=0cm}
\pagestyle{empty}

\newcommand{\yigobox}{\noindent\makebox[2.11cm][l]{yigo}}

\newcommand{\pagepar}[1]% #1 = character or box at end
{\ifvmode\vfill\fi\hfill{#1}\newpage}

\newcommand{\pagenopar}[1]% #1 = character or box at end
{#1\parfillskip=0pt\newpage\parfillskip=0pt plus1fil\noindent}

\newdynamicframe[1]{29.7cm}{7cm}{0cm}{0cm}[title]
\setdynamiccontents*{title}{%
\begin{tikzpicture}
\draw[color=black!60!red]
  (0,0) (29.7,7)%bounding box
  (5.7,1.93) rectangle +(18.3,3.14)
  (5.77,2) rectangle +(18.16,3)
  (6.2,2.43) rectangle +(17.3,2.14)
  (6.27,2.5) rectangle +(17.16,2)
  (7.67,2.5) rectangle +(.07,2)
  (8.27,2.5) rectangle +(.07,2)
  (21.47,2.5) rectangle +(.07,2)
  (21.97,2.5) rectangle +(.07,2);
\node[rotate=90] at (6.97,3.5) {\leftside};
\node[rotate=-90] at (22.67,3.5) {\rightside};
\end{tikzpicture}}

\newdynamicframe[2]{29.7cm}{7cm}{0cm}{0cm}[image]
\setdynamiccontents*{image}{%
\begin{tikzpicture}
\draw[color=black]
  (0,0) (29.7,7)%bounding box
  (2.63,1.06) rectangle +(24.1,4.94)
  (2.7,1.13) rectangle +(23.96,4.8)
  (3.2,1.63) rectangle +(22.9,3.74)
  (3.27,1.7) rectangle +(22.76,3.6)
  (4.5,1.7) rectangle +(.07,3.6)
  (5,1.7) rectangle +(.07,3.6)
  (12.38,1.7) rectangle +(.07,3.6)
  (12.94,1.7) rectangle +(.07,3.6)
  (16.24,1.7) rectangle +(.07,3.6)
  (16.8,1.7) rectangle +(.07,3.6)
  (24.3,1.7) rectangle +(.07,3.6)
  (24.8,1.7) rectangle +(.07,3.6);
\node at (14.625,3.5) {\image};% max width=3.2cm, max height=3.6cm
\node[rotate=90] at (3.92,3.5) {\leftside};
\node[rotate=-90] at (25.45,3.5) {\rightside};
\end{tikzpicture}}
% set up text flow arround image
\def\textflowimage{\shapepar[1cm]{{9.5}% text flow arround image
{0} b{0} b{11.8}\\
{0} t{0}{7} t{11.8}{7.1} \\
{3.6} t{0}{7} t{11.8}{7.1} \\
{3.6} e{7} e{18.9}}}

\newdynamicframe[3-100]{29.7cm}{7cm}{0cm}{0cm}[standard]
\setdynamiccontents*{standard}{%
\begin{tikzpicture}
\draw[color=black]
  (0,0) (29.7,7)%bounding box
  (2.63,1.18) rectangle +(24.1,4.64)
  (3.43,1.18) rectangle +(22.5,4.64);
\node[above,inner sep=0] at (14.85,6.1) {\header};
\node[rotate=90] at (3.03,3.5) {\leftside};
\node[rotate=-90] at (26.33,3.5) {\rightside};
\end{tikzpicture}}

\newflowframe[1]{12.7cm}{1.5cm}{8.5cm}{2.6cm}
\newflowframe[2]{18.9cm}{3.5cm}{5.3cm}{1.7cm}
\newflowframe[3-100]{22.3cm}{4.3cm}{3.5cm}{1.4cm}

\def\imageH{3.6cm}% max height of image
\def\imageW{3.2cm}% max width of image

\def\leftside{}% default
\def\rightside{}% default
\def\image{}% default
\def\header{}% default

\begin{document}
\Large
\def\leftside{left side \thepage}
\def\rightside{right side \thepage}
\noindent Title page.
\newpage
\def\image{\includegraphics[width=\imageW,height=\imageH]{image}}
\textflowimage\yigobox
This is a test of the ability to flow text around the image in the center of this page.
\newpage
\def\header{header}
\yigobox
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum
gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habi-
tant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum
urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget
sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. 
\pagenopar{}Curabitur auctor semper nulla. Donec
varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
\end{document}

title image standard page break

I assume page 2 is printed on the back of the title page, otherwise I'll need to add some blank pages.

  • This looks really great and I am very thankful for this. Do you know how to get every even sided page flipped upside down? – jollyroger Jun 15 '14 at 10:51
  • 1
    Are you sure you need to? Try printing all 4 pages on your printer (landscape) and see if the flip over correctly. – John Kormylo Jun 15 '14 at 17:46
  • 1
    Have you ever seen 2 sided documents printed in landscape? Every other page is printed upside down. It has to do with left-right becoming up-down. – John Kormylo Jun 19 '14 at 14:40
  • 1
    I'm confused about features like yigo. The instruction place it off to the right, but the example shows it inside the text area. If it can be placed in the text flow (as a box), it is easier to do so. If it has to be placed at a specific location on the page and have text flow around it, big trouble! – John Kormylo Jun 20 '14 at 22:21
  • 1
    Manually adding page breaks doesn't seem like a very elegant solution. What happens if I add text in between page breaks? Then I have to move the page breaks and do several renders in order to get everything looking good. Then I have to repeat the process every time I modify the text. Is there no way to solve this? Perhaps a document class is required? – jollyroger Jun 25 '14 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.