maieul / ledmac

package reledmac for latex
http://www.ctan.org/tex-archive/macros/latex/contrib/reledmac
54 stars 28 forks source link

Sync to point within a paragraph #546

Open floriandk opened 8 years ago

floriandk commented 8 years ago

When using reledpar to print different witnesses of the same text, lacunae in one of the them often end (and thus the extant text starts) in the middle of paragraphs. Would it be possible to get a sort of hook to put in the complete text and to have the other sync to without triggering a visible new paragraph in the complete text?

E.g. in the following I'd need the text on the right to start corresponding to the left line 7.

\documentclass[a5paper,12pt]{article}
\usepackage{geometry}

\usepackage[english]{babel}
\usepackage[pangram]{blindtext}
\usepackage[series={A},noend,nocritical,noeledsec]{reledmac}
\usepackage{reledpar}

\begin{document}

\date{}
\title{Sync to point within a paragraph}
\maketitle

\begin{pages}
    \begin{Leftside}
        \beginnumbering
            \pstart
                \blindtext[8] 
\emph{Sync to this point!}
                \blindtext[6]
            \pend\pstart
                2. \blindtext[5]
            \pend
        \endnumbering
    \end{Leftside}
    \begin{Rightside}
        \beginnumbering
            \pstart
\emph{Should start at l.~7.}
                \blindtext[6]
            \pend\pstart
                2. \blindtext[5]
            \pend
            \endnumbering
    \end{Rightside}
\end{pages}
\Pages

\end{document}
maieul commented 8 years ago

the questions was already asked on the past. for now, I have no solution without changing all the system of synchronism. In any case, the sync can only the start point of a right / left paragraph to a middle point of a left / right paragraph, not two points of paragraph in // side.

Won't have time before a lot …

maieul commented 8 years ago

Personnal notes for when I will have time:

floriandk commented 8 years ago

If this is cumbersome and requires major changes please don't waste your time on it, as it will be possible to imitate this behaviour in one way or another:

  1. The easiest is just to add the missing text to the lacuna and colour it white. This is very precise and looks good, but has the disadvantage of the fake text being present and searchable in the pdf, though invisible. This might prove a problem when publishing the pdf directly or theoretically with some printers.
  2. Fill with empty lines. I tried this to determine the number of lines:
\documentclass[a5paper,10pt]{article}
\usepackage{geometry}

\usepackage[english]{babel}
\usepackage[pangram]{blindtext}
\usepackage[series={A},noend,nocritical,noeledsec]{reledmac}
\lineation{pstart}
\usepackage{reledpar}

\newcount\lacunalinescounter

\newcommand{\lacunasync}[1]{%
  \lacunalinescounter1%
  \loop\ifnum\lacunalinescounter < #1 %
  \strut\\\skipnumbering%
  \advance\lacunalinescounter by 1 % 
  \repeat %
}

\begin{document}

\date{}
\title{Sync to point within a paragraph – hack}
\maketitle

\begin{pages}
    \begin{Leftside}
        \beginnumbering
            \pstart
                \blindtext[8] 
\edlabel{sync-here}\emph{Sync to this point!}
                \blindtext[6]
            \pend\pstart
                2. \blindtext[5]
\edlabel{sync-here-two}\emph{Sync to this point!}
                \blindtext[5]
            \pend
        \endnumbering
    \end{Leftside}
    \begin{Rightside}
        \beginnumbering
            \pstart
\lacunasync{\edlineref{sync-here}}%
\emph{Should start at l.~7.}
                \blindtext[6]
            \pend\pstart
\lacunasync{\edlineref{sync-here-two}}%
\emph{Should start at l.~5.}
                \blindtext[5]
            \pend
            \endnumbering
    \end{Rightside}
\end{pages}
\Pages

\end{document}

The downside is that it requires \lineation{pstart}. I'd be completely happy with it if I could read the p-wise line-number from somewhere while using \lineation{pstart} or \lineation{section} for all other purposes. Is that possible?

maieul commented 8 years ago

� Fill with empty lines. I tried this to determine the number of lines:

This second solution is what I think for implementation. It is possible to read the number of line of a \pstart, but for now only when typesetting the pstart (so inside the \Pages command) and not when reading it

floriandk commented 8 years ago

I see...

It doesn't seem possible to \stepcounter in \do(inside)linehook, is it? This would also be a possibility to count the lacuna-lines.

maieul commented 8 years ago

same problem. \do(inside)linehook is when typesetting the hooks.

floriandk commented 8 years ago

quel dommage...

If any other user should be interested: For both \lineation{section} and \lineation{pstart} a hack like

\usepackage{ifthen}

\newcommand{\lacunastart}[1]{\edlabel{lacunastart#1}}
\newcommand{\lacunaend}[1]{\edlabel{lacunaend#1}%
  \newcounter{lacunalines#1}%
  \setcounter{lacunalines#1}{\edlineref{lacunaend#1}}%
  \addtocounter{lacunalines#1}{-\edlineref{lacunastart#1}}%
  \addtocounter{lacunalines#1}{1}%
}

\newcounter{lacunalinescounter}

\newcommand{\lacunasync}[1]{%
  \setcounter{lacunalinescounter}{1}%
  \whiledo{\value{lacunalinescounter} < \value{lacunalines#1}}{%
  \strut\\\skipnumbering%
  \stepcounter{lacunalinescounter}% 
  }%
}

seems to work alright and they will do for my purposes for the time being.

floriandk commented 6 years ago

I suppose you haven't had the time to work on this issue in the meantime, have you?

I wrote above that I'd suggest not to make this feature-request a priority, because one could find alternative solutions (like the ones I mentioned above) to this rare problem. I'd like to qualify this point of view now ;)

As I see with my present work, there will anyway be cases in which one would want to link many shorter text-blocks on one side to specific places of a long unbroken text on the other. Using my hacks sort-of works, but it is quite cumbersome. And they don't allow for page-wise enumeration.

Thus it would be really great if you could get around to implement a good robust solution in reledpar one day.