mkparallel run badly

This commit is contained in:
uni@bor.mac 2024-10-02 02:26:03 +02:00
parent 095e19700e
commit 8bfe9960f6
5 changed files with 288 additions and 15 deletions

View File

@ -67,8 +67,10 @@ s=4: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 -> 16,01.02,15 14,03.04,13 12,05.06,
---
### TODO
- [ ] create md2verse.sh
- [ ] create md2parallel.sh
- [x] create md2verse.sh
- [ ] create mk2parallel.sh
- [ ] fix geometry bug
- [ ] fix multi-word string chapter bug
- [ ] create md2tex.sh
- [ ] create pdf2sig.sh /pdf2book.py -s/--sigsize [0,3,4,5]
- [ ] insert cleaning step (html to md)

View File

@ -8,7 +8,10 @@ USAGE="""USAGE:
if [ $# -ne 1 ] ; then echo "$USAGE" && exit 1; fi
INFILE=$1
# remove any suffix https://stackoverflow.com/a/36341390
BASENAME=$(basename "${INFILE%.*}")
BASENAME=$( basename "${INFILE%.*}" )
DIRNAME=$( dirname "$INFILE" )
#echo $BASENAME
#echo $DIRNAME
KEEP_TMP_FILES=0
#set -x
@ -18,10 +21,12 @@ KEEP_TMP_FILES=0
# TODO
# check if same number of paragraphs?
# convert md to html
pandoc -f markdown ${BASENAME}.md -t html -o ${BASENAME}.html
pandoc --wrap=none -f markdown $DIRNAME/${BASENAME}.md -t html -o ${BASENAME}.html
# convert html to tex
sed -i '' 's@<p>@\n\\pstart\n@' ${BASENAME}.html
sed -i '' 's@</p>@\n\\pend@' ${BASENAME}.html
#sed -i '' 's@<p>@\n\\pstart\n@' ${BASENAME}.html
#sed -i '' 's@</p>@\n\\pend@' ${BASENAME}.html
sed -i '' 's@<p>@\n\\pend\\pstart\n@' ${BASENAME}.html
sed -i '' 's@</p>@@' ${BASENAME}.html
sed -i '' 's@“@\\enquote{@g' ${BASENAME}.html
sed -i '' 's@”@}@g' ${BASENAME}.html
sed -i '' 's@<h1.*">@\\section[@' ${BASENAME}.html

View File

@ -26,7 +26,9 @@ PATH=$PATH:$WD
pushd $TMPDIR > /dev/null
# CONVERT MD TO TEX
for tex in $( echo $INFILES | grep '.md$' )
#IFS_OLD=$IFS
#IFS="\n"
for tex in $( echo "$INFILES" | grep '.md$' )
do
if [[ -f $WD/$tex ]]
then
@ -40,15 +42,18 @@ do
fi
fi
done
#IFS=$IFS_OLD
# CREATE WRAPPER
WRAPPER="""
%\documentclass[twoside]{$DOCCLASS}
\documentclass[twoside]{$DOCCLASS}
\usepackage[fontsize=${FONTSIZE}pt]{fontsize}
\usepackage[${PAGESIZE}paper]{geometry}
\usepackage{libertine} % also loads fontspec which is needed for ɔ and ɛ
\usepackage{minitoc} % make mini table of content for each chapter
%\usepackage{minitoc} % make mini table of content for each chapter
\usepackage{graphicx} % include graphics
\usepackage{placeins} % https://tex.stackexchange.com/a/88659/264579
\usepackage{csquotes} % \enquote
\usepackage{reledmac} % needed for repedpar
\usepackage{reledpar} % parallel text
@ -89,21 +94,22 @@ do
first_lang="false"
else
echo "{ $( echo $input | sed 's/.md/.tex/' ) }" >> $PROJECT.tex
echo '\clearpage' >> $PROJECT.tex
fi
else
#is chapter
echo '\chapter' " { $input }" >> $PROJECT.tex
fi
echo '\clearpage' >> $PROJECT.tex
done
echo "$WRAPPER_END" >> $PROJECT.tex
# CREATE PDF
$LATEX_ENGINE $PROJECT.tex 2&> /dev/null
$LATEX_ENGINE $PROJECT.tex 2&> /dev/null
echo $TMPDIR
$LATEX_ENGINE $PROJECT.tex # 2&> /dev/null
$LATEX_ENGINE $PROJECT.tex # 2&> /dev/null
# $LATEX_ENGINE $PROJECT.tex
popd > /dev/null
cp -r $TMPDIR $WD/$PROJECT
rm -rf $WD/$PROJECT
cp -r $TMPDIR $WD/$PROJECT/
echo "File $PROJECT.pdf created at $WD/$PROJECT/"
rm -rf $TMPDIR

260
parallel-template.tex Normal file
View File

@ -0,0 +1,260 @@
\documentclass[twoside]{$DOCCLASS}
\usepackage[fontsize=${FONTSIZE}pt]{fontsize}
\usepackage[${PAGESIZE}paper]{geometry}
%\usepackage[paperheight=210mm,paperwidth=148mm,heightrounded,bindingoffset=1cm]{geometry} % A5
\usepackage{libertine} % also loads fontspec which is needed for ɔ and ɛ
\usepackage{minitoc} % make mini table of content for each chapter
\usepackage{graphicx} % include graphics
%\usepackage{efbox} % frame around graphics https://tex.stackexchange.com/a/519894/264579
%\usepackage{titling} % create custom title page and https://tex.stackexchange.com/a/67499/264579
%\usepackage{tcolorbox} % https://en.wikipedia.org/wiki/Colophon_(publishing)
%\usepackage{placeins} % https://tex.stackexchange.com/a/88659/264579
\usepackage{csquotes} % \enquote
%\usepackage{nameref} % https://tex.stackexchange.com/a/66898/264579
%%% glossary
%\usepackage[nonumberlist,
% toc,
% style=listgroup
% ]{glossaries-extra} % glossaries-extra because reledpar conflicts with glossaries
%\usepackage{glossary-mcols} % multi column glossary https://www.dickimaw-books.com/gallery/glossaries-styles/#mcol
%\newcommand{\dictentrysorted}[3]{%
% \newglossaryentry{#1}{
% name=#1,
% sort=#2,
% description={#3}
% }%
% \glslink{#1}{}%
%}
%\glsaddall % print glossary entries not mentioned in text
%\renewcommand*{\glspostdescription}{} % Removes dots at the end of each entry.
%\makeglossaries
%\usepackage{morewrites} % allows LaTeX to have many files open
\usepackage{reledmac} % needed for repedpar
\usepackage{reledpar} % parallel text
%\firstlinenum*{1000}
%\linenumincrement*{1000}
\newcommand{\pagesinclude}[2]{
\begin{pages}
\begin{Leftside}
\beginnumbering
\pstart\input{#1}\pend
\endnumbering
\end{Leftside}
\begin{Rightside}
\beginnumbering
\pstart\input{#2}\pend
\endnumbering
\end{Rightside}
\end{pages}
\Pages
}
%\newcommand{\mkcolophon}[1]{
% %\clearpage
% \thispagestyle{empty}
% \begin{vplace}[0.7]
% \begin{centering}
% \iffalse
% \begin{HUGE}
% \begin{tcolorbox}
% \centering
% \texttt{rwx}\\
% \texttt{press}\\
% \end{tcolorbox}
% \end{HUGE}
% \fi
% \begin{HUGE}
% \thetitle
% \end{HUGE}
% \\
% \vspace{3cm}
%% \begin{figure}
%% \centering
% \includegraphics[width=.3\textwidth]{img/onipa_logo.png}
%% \end{figure}
% \vspace{1cm}
% \par\noindent\rule{\textwidth}{0.4pt}
% \large { \the\year{} }\\
% #1\\
% \end{centering}
% \end{vplace}
% \clearpage
%}
%\newcommand{\todo}[1]{\textcolor{red}{#1}}
%\newcommand{\td}[1]{\textcolor{red}{#1}}
%\newlength\qrmargin
%\setlength\qrmargin{20pt}
%\newlength\qrwidth
%\setlength\qrwidth{0.2\textwidth}
%%\newlength\adinkrawidth
%\setlength\adinkrawidth{0.5\textwidth}
%\newcommand{\printqr}[2]{
%% \deflen{qrmargin}{20pt}
%% \deflen{qrwidth}{0.2\textwidth}
% %\parbox{\textwidth}{#2}
% \vspace{1cm}
% \hfill
% \begin{minipage}{.75\textwidth}
% \centering
%% \begin{figure}
% % \efbox[linewidth=\qrmargin, linecolor=white]{
% \includegraphics[width=\qrwidth]{#1}
% % }
%% \newline
% \centering
%% \parbox{\textwidth}{\centering #2}
% #2
%% \end{figure}
%% \frame{#2}
% \end{minipage}
% \hfill
%}
\title{$TITLE}
\author{$AUTHOR}
\begin{document}
\maketitle
%\input{chapter/02_title_page.tex}
%%%
%\begin{titlingpage} %This starts the title page
% \begin{center}
% % ~
% \vspace{2cm} %put the distance you need.
% % ~
% \begin{Huge}
% \textbf{\thetitle} \\
% \end{Huge}
% \vspace{3cm} %put the distance you need.
% \begin{large}
% \theauthor\\
% \end{large}
% %\thedate
% \begin{figure}[hb]
% \centering
% \includegraphics[width=\adinkrawidth]{img/sankofa.jpeg}
% \end{figure}
% \vspace{3cm} %put the distance you need.
% \begin{figure}[hb]
% \centering
%% \includegraphics[width=.2\textwidth]{img/ghana_flag.jpeg}
% \end{figure}
% \end{center}
%\end{titlingpage}
%%%
%\input{chapter/03_colophon.tex}
%%%
%\mkcolophon{Deɛ Ɛdi Kan\\First Edition}
%%%
%\input{chapter/04_acknowledgments.tex}
%%%
%%%
%\input{chapter/05_preface.tex}
%%%
%\section*{Introduction}
%% creation of this book
%%This book was born out of necessity, who is the mother of all inventions.
%\enquote{Necessity is the mother of all inventions.}
%A sentence my mother did not fail to repeat.
%This aphorism also holds true for this anthology.
%
%\enquote{Nsɛm wɔ Twi ne Brɔfo} tries to embrace the principle of comprehensible input (pioneered by Stephen Krashen). % Stephen Krashen and https://www.youtube.com/watch?v=d0yGdNEWdn0
%The texts in this volume should not only be intelligible but also enjoyable and interesting.
%The enjoyable character of most of the texts will hopefully retain the reader's attention
%despite the extra effort of reading another tongue.
%
%
%% structure of this book
%This book comprises of parallel Akan and English texts and is mainly aimed at Twi learners.
%The Twi version is printed on the left side
%and the English version on the right side.
%At the end of some chapters there are QR codes which - when scanned - will lead to the original source, which can be listened to while reading.
%Listening to spoken Twi will further strengthen the listening comprehension of the reader.
%% orthography and language
%
%%The reader of this volume should note that the orthography of this edition has not yet been standardized.
%The attentive reader might find various spellings for the same word.
%This is mainly due to lack of time on the authors side, but the mixed orthography possesses its own benefits. % side and will be targeted in future editions
%%On first thought this might confuse an beginner reader but it will also help
%The Twi learner will improve the feeling for a word's pronunciation by encountering it in different spellings.
%Furthermore, all texts - unless indicated - strive to be written in Asante Twi. % but don't (yet) claim to follow the orthography strictly.
%The orthography and expressions from other dialects might found here and there, though.
%%no guarantee can be given that all texts and words are written in Asante Twi.
%
%
%% book box inc
%The first chapter comprises stories, related and translated by bookboxinc.
%These short tales from all over the world are originally narrated (with illustrations) in various languages.
%
%% songs
%The next chapter deals with Twi songs and their translations.
%The idea of including songs is rooted in the fact that songs are heard repeatedly and thus can be used as enjoyable comprehensible input.
%Songs are also a useful source of up-to-date speech and slang words.
%
%% anansesem
%The stories in the Anansesɛm chapter are the heart of this edition.
%%The stories in the \ref{sec:anansesem} are the heart of this edition.
%This section will grow most in future editions of this work.
%These Anansesɛm were recorded in Twi and translated to English in the early 20th century.
%Thus, they might exhibit old words and expressions.
%It should be noted, that these tales are the only original Twi prose in this book.
%Being originally Twi, they give us meaningful insight into Akan culture.
%
%% bible
%The bible was probably the first book translated into Twi.
%It is a useful resource for language learning.
%Three books (one from the old testament and two from the new testament)
%were selected to be included as reading examples.
%
%% udhr
%The universal declaration of human rights was also included and can be used to compare the different dialects of Twi and Fante.
%
%% Dictionary
%Finally, the book is topped off by a Twi-English dictionary.
%The dictionary will include phrasal verbs in the next edition.
%%%
%\clearpage
%\dominitoc
\tableofcontents
%\adjustmtc
%\clearpage
%\input{chapter/50_anansesem.tex}
%%%
%\chapter{Anansesem - Ghanaian Folk Tales}
%\label{sec:anansesem}
%\minitoc
%\begin{figure}[hb]
% \centering
% \includegraphics[width=\adinkrawidth]{img/mate_masie.png}
%\end{figure}
%
%%\setlength{\Lcolwidth}{0.30\textwidth}
%\pagesinclude
%{chapter/50_anansesem/51_anansesem-akan-twi.tex}
%{chapter/50_anansesem/51_spider_stories-english.tex}
%%\setlength{\Lcolwidth}{0.45\textwidth}
%%%
%\input{chapter/90_dictionary.tex}
%%%
%\input{chapter/90_dictionary/99_dictionary.tex}
%\printglossary[
% title=Twi-English Dictionary,
% style=mcolindexgroup]%
%%%
\end{document}

View File

@ -1,4 +1,4 @@
LATEX_ENGINE="pdflatex"
LATEX_ENGINE="xelatex"
DOCCLASS="memoir"
DOCCLASS_EXTRA="twoside"
FONTSIZE="10"
@ -7,7 +7,7 @@ PROJECT="asem"
TITLE="Nsɛm wɔ Twi ne Brɔfo\\\LARGE Texts in Twi and English"
AUTHOR=""
INFILES="""
Anansesem - Ghanaian Folk Tales
'Anansesem - Ghanaian Folk Tales'
testfiles/parallel-ak.md
testfiles/parallel-en.md
"""