Text FormattingFormatting problems with verbatim and numbering

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
mishaperez
Posts: 3
Joined: Fri Jan 29, 2016 12:10 am

Formatting problems with verbatim and numbering

Post by mishaperez »

Hi!

I'm trying to typeset a book with an original text on the left page and its translation on the right page for a commented edition and as part of a doctoral thesis. After searching a lot of hours, I made it, but now I have other problem and I can't find any solution. The problem is that both texts are in verse, and I'd like the verses to be numbered, but whatever I do numbering always begins with the title as the first numbered line. The poem and it's translation are very long texts and I need an easy way to get them numbered and well build. I thought that using verbatim would help, but it doesn't look like. I also tried verse and listing, but it was even worst.

It's my first day with latex.I apologize for my bad understanding of latex terminology and for my faulty english.

Here the .tex:

Code: Select all

\documentclass[12pt,twoside]{book}

\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[L7x]{fontenc}
\usepackage{geometry}
\usepackage[pangram]{blindtext}
\usepackage{eledmac}
\usepackage{eledpar}
\maxhnotesX{0.4\textheight}

\date{}

\begin{document}

\large

\begin{titlepage}

\centering
	{\scshape\LARGE BLABLABLA\par}
	\vspace{1cm}
	{\scshape\Large BLEBLEBLE\par}
	\vspace{1.5cm}
	\vfill
	traducción de \par
	Ba Be Bi \textsc{}

	\vfill


\end{titlepage}

\begin{pages}

\begin{Leftside}

\pstart

\section*{\centering\LARGE BLABLABLA \\ \centering\small Blublublu \\ \\}


\begin{verbatim}


Bla ble bli blo blu
Ble Bli Blo Blu Bla
Bli Blo Blu Bla Ble

Bla ble bli blo blu
Ble Bli Blo Blu Bla
Bli Blo Blu Bla Ble


\end{verbatim}}


\blindtext[10]\footnoteAnomk
\blindtext[20]}
\pend

\end{Leftside}


\begin{Rightside}
\beginnumbering
\pstart

\section*{\centering\LARGE Ble Bli Blo \\ \centering\small Ta Te Ti To Tu \\ \\}


\begin {verbatim}


Bla ble bli blo blu
Ble Bli Blo Blu Bla
Bli Blo Blu Bla Ble

Bla ble bli blo blu
Ble Bli Blo Blu Bla
Bli Blo Blu Bla Ble


\end{verbatim}

\blindtext[16]\footnoteAmk
\pend
\endnumbering
\end{Rightside}
\Pages
\end{pages}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Formatting problems with verbatim and numbering

Post by Johannes_B »

The very first error i get with your example is about the package eledmac, which is deprecated and substituted by reledmac. If this is your first day, you should realy use the most modern packages.

A few other errors follow, for example by setting up the sections the wrong way. If you want your sections to look always the same, define a new command.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
mishaperez
Posts: 3
Joined: Fri Jan 29, 2016 12:10 am

Re: Formatting problems with verbatim and numbering

Post by mishaperez »

Hi Johannes.

Thank you for your answer and your suggestions.Yes, it was my first serious day with latex. Today is my second. :)

I've substituted eledmac for reledmac, and now I'm reading the information about this package. It's great!
The order of sections? I don't know what error can it be. I'll try to research a bit more. Could that be the problem with numeration of verses? It seem like verbatim numerate everything in the page, and I just want it to numerate from a point, when poem begins.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Formatting problems with verbatim and numbering

Post by Johannes_B »

Verbatim and listings are for includong code fragments, like Java, C++ or even LaTeX. There is some magic behind it.

Packages reledmac/reledpar can number lines for you.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Formatting problems with verbatim and numbering

Post by Stefan Kottwitz »

An important point in LaTeX is, that we don't put a lot of formatting commands into the text. Maybe even no formatting command at all. It's not good to repeat formatting commands in each section heading. Instead, we define once that all sections shall be bold and large, maybe even centered.

There are packages for customizing things. For example, for this kind of heading I would use titlesec:

Code: Select all

\usepackage{titlesec}
\titleformat{name=\section}{\normalfont\LARGE\bfseries\scshape\centering}{\thesection}{1em}{}
\titleformat{name=\section,numberless}{\normalfont\LARGE\bfseries\centering}{}{0em}{}
For such subheadings, one may use the epigraph package:

Code: Select all

\usepackage{epigraph}
\renewcommand{\epigraphsize}{\small\bfseries}
\setlength{\epigraphrule}{0pt}
\setlength{\beforeepigraphskip}{-2ex}
\setlength{\afterepigraphskip}{0pt}
\renewcommand{\textflush}{center}
\renewcommand{\epigraphflush}{center}
Then you can write in your document:

Code: Select all

\section*{BLABLABLA}
\epigraph{Blublublu}{}
Full minimal example:

Code: Select all

\documentclass[12pt,twoside]{book}
\usepackage{lmodern}
\usepackage[pangram]{blindtext}
\usepackage{titlesec}
\titleformat{name=\section}{\normalfont\LARGE\bfseries\scshape\centering}
  {\thesection}{1em}{}
\titleformat{name=\section,numberless}{\normalfont\LARGE\bfseries\centering}{}{0em}{}
\usepackage{epigraph}
\renewcommand{\epigraphsize}{\small\bfseries}
\setlength{\epigraphrule}{0pt}
\setlength{\beforeepigraphskip}{-2ex}
\setlength{\afterepigraphskip}{0pt}
\renewcommand{\textflush}{center}
\renewcommand{\epigraphflush}{center}
\begin{document}
\section*{BLABLABLA}
\epigraph{Blublublu}{}
\blindtext
\end{document}
example.png
example.png (35.02 KiB) Viewed 4150 times
It took me a bit of settings since your two-part heading is a bit unusual.

Stefan
LaTeX.org admin
Post Reply