patternMinor
English-Latin bilingual book with line numbers and bibliography
Viewed 0 times
englishlinebookwithnumbersbibliographylatinandbilingual
Problem
I just released a book with a deadline. My first job with LaTeX, very messy. I wondered if there is anybody out there, who would be so kind and take a look at the code and see, what optimizations can be done. I am releasing the same book in Danish/Latin (as you see, the code is in English/Latin) and I would like to have a better, more customizable code.
I know that I should clean up the
`\documentclass[a4paper,twoside]{book}
\usepackage[english,ngerman]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[pagewise,switch,modulo]{lineno}
\usepackage[left=101pt,right=101pt,top=96pt,bottom=96pt]{geometry}
\usepackage{wrapfig,booktabs}
\usepackage{fancyhdr}
\usepackage[autostyle,german=quotes]{csquotes}
\usepackage{array,tabularht}
\usepackage{floatrow}
\usepackage{hyperref}
\usepackage{afterpage}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{Nicolaus Cusanus}
\fancyhead[RO]{Nicholas of Cusa}
\fancyhead[RE]{Epistula ad Nicolaum Bononiensem}
\fancyhead[LO]{Letter to Nicholas of Bologna}
\fancyfoot[CE,CO]{\leftmark}
\fancyfoot[LE,RO]{\thepage}
\newcommand{\R}[1]{\label{#1}\linelabel{#1}}
\newcommand{\Lr}[1]{page~\pageref{#1}, line~\lineref{#1}}
\newcommand{\lr}[1]{~\lineref{#1}:}
\newcommand\blankpage{%
\null
\thispagestyle{empty}%
\addtocounter{page}{-1}%
\newpage}
\newcommand\blankpagenumber{%
\null
\thispagestyle{empty}%
\newpage}
\hypersetup{
colorlinks=false,
pdfborder={0 0 0},
}
\begin{document}
\begin{otherlanguage}{english}
\thispagestyle{empty}
\addtocounter{page}{-1}
\topskip0pt
\vspace*{\fill}
{\centering
{\huge Nicholas of Cusa\par}
\vspace{1.0cm}
{\huge Letter to Nicholas of Bologna\par}
\vspace{1.0cm}
{\huge June 11, 1463\par}
}
\vspace*{\fill}
\afterpage{\blankpage}
\newpage
\thispagestyle
I know that I should clean up the
\\ at the end of the paragraphs. My main concern is to not have to separate the actual text for every page, as is necessary right now. But I would really like to have the whole code cleaned up!`\documentclass[a4paper,twoside]{book}
\usepackage[english,ngerman]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[pagewise,switch,modulo]{lineno}
\usepackage[left=101pt,right=101pt,top=96pt,bottom=96pt]{geometry}
\usepackage{wrapfig,booktabs}
\usepackage{fancyhdr}
\usepackage[autostyle,german=quotes]{csquotes}
\usepackage{array,tabularht}
\usepackage{floatrow}
\usepackage{hyperref}
\usepackage{afterpage}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{Nicolaus Cusanus}
\fancyhead[RO]{Nicholas of Cusa}
\fancyhead[RE]{Epistula ad Nicolaum Bononiensem}
\fancyhead[LO]{Letter to Nicholas of Bologna}
\fancyfoot[CE,CO]{\leftmark}
\fancyfoot[LE,RO]{\thepage}
\newcommand{\R}[1]{\label{#1}\linelabel{#1}}
\newcommand{\Lr}[1]{page~\pageref{#1}, line~\lineref{#1}}
\newcommand{\lr}[1]{~\lineref{#1}:}
\newcommand\blankpage{%
\null
\thispagestyle{empty}%
\addtocounter{page}{-1}%
\newpage}
\newcommand\blankpagenumber{%
\null
\thispagestyle{empty}%
\newpage}
\hypersetup{
colorlinks=false,
pdfborder={0 0 0},
}
\begin{document}
\begin{otherlanguage}{english}
\thispagestyle{empty}
\addtocounter{page}{-1}
\topskip0pt
\vspace*{\fill}
{\centering
{\huge Nicholas of Cusa\par}
\vspace{1.0cm}
{\huge Letter to Nicholas of Bologna\par}
\vspace{1.0cm}
{\huge June 11, 1463\par}
}
\vspace*{\fill}
\afterpage{\blankpage}
\newpage
\thispagestyle
Solution
I'm not a LaTex expert by any means, but I think I can help with this. First, it's important to step back and remember the original purpose for LaTeX. Quoting from https://www.latex-project.org/
LaTeX is not a word processor! Instead, LaTeX encourages authors not to worry too much about the appearance of their documents but to concentrate on getting the right content.
That's what makes it so useful and flexible. The LaTeX in your book, on the other hand, spends much too much effort on the appearance, and so while you have succeeded with Herculean effort, you will find things much easier and much more pleasing if you work with LaTeX instead of against it. I hope to help you think of ways to do that with the following review.
Think about your requirements
Think about what you are trying to do. Essentially, you are writing a translation of one document into another language. The structure of the document is such that you'd also like to retain both ties to the original source material (the Bredow text) and to the translated text. Your choice of using facing pages for original/translation (Latin/English in this case) is an appropriate choice with a long history in literature. Keeping the whole picture in mind is useful in many projects, and this one is no exception.
Consider the user interface
Unlike a lot of code here on Code Review, you are effectively both the programmer and the user of this, which offers great opportunity to tune things exactly to your preferences. The way the current document is written is very much page-based rather than content-based. It seems to me that it would be much easier to instead work on translating paragraph at a time and letting LaTeX worry about pagination. To that end, I would recommend the use of the
Use the right languages
Because you're writing in Latin and English for this document, you should specify those as the languages for babel:
Use annotation for source linkage
Instead of manually laying out a column to refer to original source material page and line numbering, better would be to define a command to represent the left text, the source line number and the right (translated) text. Here's one way to do that using the
Sample document
`\documentclass[a4paper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[latin,english]{babel}
\usepackage{fancyhdr}
\usepackage{paracol,lineno}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{Nicolaus Cusanus}
\fancyhead[RO]{Nicholas of Cusa}
\fancyhead[RE]{Epistula ad Nicolaum Bononiensem}
\fancyhead[LO]{Letter to Nicholas of Bologna}
\fancyfoot[CE,CO]{\leftmark}
\fancyfoot[LE,RO]{\thepage}
\linenumbers \modulolinenumbers[5]
\setlength\linenumbersep{1em}
\newcommand\LR[3]{\selectlanguage{latin}#1 \marginpar{\tiny #2}\switchcolumn
\selectlanguage{english} #3 \switchcolumn}
\title{Letter to Nicholas of Bologna}
\author{Nicholas of Cusa}
\date{June 11, 1463}
\begin{document}
\makeatletter
\begin{titlepage}
\begin{centering}
\nolinenumbers
{\huge
\@title
\@author
\@date
Translation by Hans Frederik Ross Nielsen }
\end{centering}
\end{titlepage}
\makeatother
\reversemarginpar
\linenumbers
\begin{paracol}[1]*{2}
\LR{Epistola reverendissimi in Christo patris domini
Nicolai, cardinalis sancti Petri ad vincula, ad religiosum Nicolaum,
novitium Montisoliveti ut quantum sufficit se ipsum cognoscat.}{26}{
Letter from the most venerable father in Christ, Lord Nicholas, Cardinal
at St. Peter in Chains, to the pious Nicholas, novice \textit{Of the
Mount of Olives}, that he might sufficiently recognize himself.}
\LR{ 1. Placuit deo et religiosis fratribus, ut te Nicolaum Bononiensem,
zelosum adolescentem, in sancta die beatissimae trinitatis in nominatissimo
monasterio Montisoliveti monastico illius loci habitu vestirem ac aliqua
dicerem ad tui fervoris augmentum, quae nunc in scriptis redegi quibusdam
instantibus devotis, ut memoriale ipsorum tecum retineas, aliqua illis de
dei laudibus, in quibus vere religiosi apprime versantur, adiciens, ut
completiori doctrina quae dixi degustes.}
{26.5}
{ 1. It was pleasing to God and the religious brothers that I clothed
you, Nicholas of Bologna, a zealous youth, on the holy day of the most
blessed Trinity at the renowned monastery \textit{Of the Mount of
Olives} in the monastic habit of that place, and that I furthermore held
a sermon for the increase of your fervor. I have now written down this
sermon at the insistence of some devout men, that you may take it with
you. And in order for you to taste a more complete doctrine than the one
I spoke, I have added something about the primary subject with which the
pious engage themselves: the praises of God.}
LaTeX is not a word processor! Instead, LaTeX encourages authors not to worry too much about the appearance of their documents but to concentrate on getting the right content.
That's what makes it so useful and flexible. The LaTeX in your book, on the other hand, spends much too much effort on the appearance, and so while you have succeeded with Herculean effort, you will find things much easier and much more pleasing if you work with LaTeX instead of against it. I hope to help you think of ways to do that with the following review.
Think about your requirements
Think about what you are trying to do. Essentially, you are writing a translation of one document into another language. The structure of the document is such that you'd also like to retain both ties to the original source material (the Bredow text) and to the translated text. Your choice of using facing pages for original/translation (Latin/English in this case) is an appropriate choice with a long history in literature. Keeping the whole picture in mind is useful in many projects, and this one is no exception.
Consider the user interface
Unlike a lot of code here on Code Review, you are effectively both the programmer and the user of this, which offers great opportunity to tune things exactly to your preferences. The way the current document is written is very much page-based rather than content-based. It seems to me that it would be much easier to instead work on translating paragraph at a time and letting LaTeX worry about pagination. To that end, I would recommend the use of the
paracol package.Use the right languages
Because you're writing in Latin and English for this document, you should specify those as the languages for babel:
\usepackage[latin,english]{babel}
Use annotation for source linkage
Instead of manually laying out a column to refer to original source material page and line numbering, better would be to define a command to represent the left text, the source line number and the right (translated) text. Here's one way to do that using the
paracol package:\newcommand\LR[3]{\selectlanguage{latin}#1 \marginpar{\tiny #2}\switchcolumn
\selectlanguage{english} #3 \switchcolumn}
Sample document
`\documentclass[a4paper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[latin,english]{babel}
\usepackage{fancyhdr}
\usepackage{paracol,lineno}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{Nicolaus Cusanus}
\fancyhead[RO]{Nicholas of Cusa}
\fancyhead[RE]{Epistula ad Nicolaum Bononiensem}
\fancyhead[LO]{Letter to Nicholas of Bologna}
\fancyfoot[CE,CO]{\leftmark}
\fancyfoot[LE,RO]{\thepage}
\linenumbers \modulolinenumbers[5]
\setlength\linenumbersep{1em}
\newcommand\LR[3]{\selectlanguage{latin}#1 \marginpar{\tiny #2}\switchcolumn
\selectlanguage{english} #3 \switchcolumn}
\title{Letter to Nicholas of Bologna}
\author{Nicholas of Cusa}
\date{June 11, 1463}
\begin{document}
\makeatletter
\begin{titlepage}
\begin{centering}
\nolinenumbers
{\huge
\@title
\@author
\@date
Translation by Hans Frederik Ross Nielsen }
\end{centering}
\end{titlepage}
\makeatother
\reversemarginpar
\linenumbers
\begin{paracol}[1]*{2}
\LR{Epistola reverendissimi in Christo patris domini
Nicolai, cardinalis sancti Petri ad vincula, ad religiosum Nicolaum,
novitium Montisoliveti ut quantum sufficit se ipsum cognoscat.}{26}{
Letter from the most venerable father in Christ, Lord Nicholas, Cardinal
at St. Peter in Chains, to the pious Nicholas, novice \textit{Of the
Mount of Olives}, that he might sufficiently recognize himself.}
\LR{ 1. Placuit deo et religiosis fratribus, ut te Nicolaum Bononiensem,
zelosum adolescentem, in sancta die beatissimae trinitatis in nominatissimo
monasterio Montisoliveti monastico illius loci habitu vestirem ac aliqua
dicerem ad tui fervoris augmentum, quae nunc in scriptis redegi quibusdam
instantibus devotis, ut memoriale ipsorum tecum retineas, aliqua illis de
dei laudibus, in quibus vere religiosi apprime versantur, adiciens, ut
completiori doctrina quae dixi degustes.}
{26.5}
{ 1. It was pleasing to God and the religious brothers that I clothed
you, Nicholas of Bologna, a zealous youth, on the holy day of the most
blessed Trinity at the renowned monastery \textit{Of the Mount of
Olives} in the monastic habit of that place, and that I furthermore held
a sermon for the increase of your fervor. I have now written down this
sermon at the insistence of some devout men, that you may take it with
you. And in order for you to taste a more complete doctrine than the one
I spoke, I have added something about the primary subject with which the
pious engage themselves: the praises of God.}
Context
StackExchange Code Review Q#112465, answer score: 2
Revisions (0)
No revisions yet.