bidi-tex / bidi

Bidirectional typesetting in plain TeX and LaTeX, using XeTeX
Other
3 stars 0 forks source link

redefining \scr@dte@tocline causes failure with xetex #14

Open ExecutorElassus opened 4 years ago

ExecutorElassus commented 4 years ago

Brief outline of the issue

Please see this thread: https://latex.org/forum/viewtopic.php?f=19&t=33483&p=112872#p112872 I have a document with figure wrap floats that define their width as percentage of the column. When compiling, Xetex throws errors like the following:

`! Missing number, treated as zero.

\scr@dte@pagenumberwidth \scr@tso@figure@pagenumberbox ...@pagenumberwidth} {\hfil #1} ...scr@tso@figure@pagenumberformat}{9}} }\@par \scr@tso@figure@entryformat #1->#1 \scr@dte@tocline ...pagenumberformat}{#3}}}\@par } }}\tocbasic@SetPenaltyByTO... \l@figure ...ure}\scr@dte@tocline {figure}{#1}{#2} \TOC@EntryEndHook {figure} \contentsline ...L \endR \fi }\hyper@linkend }{#3} \or \csname l@#1\endcsname... l.65 ...el of narrative rhetoric.}}{9}{figure.2.1} % A number should have been here; I inserted `0'. (If you can't figure out why I needed to see a number, look up `weird error' in the index to The TeXbook.) ! Illegal unit of measure (pt inserted).` ## Check/indicate - [ ] Relevant to the `xepersian` package - [ ] [The `xepersian` package issue tracker](https://github.com/bidi-tex/xepersian/issues) has been searched for similar issues? - [ x] Issue tracker has been searched for similar issues? - [x ] Links to discussion if appropriate ## Minimal example showing the issue ```documentclass[12pt,oneside]{scrbook} \usepackage{fontspec} \setmainfont[Mapping=tex-text,Numbers=OldStyle]{Linux Libertine O} \setsansfont[Mapping=tex-text]{Linux Biolinum O} \usepackage[a4paper]{geometry} \geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2cm,rmargin=2cm} \usepackage{fancyhdr} \pagestyle{fancy} \setcounter{secnumdepth}{3} \setcounter{tocdepth}{1} \setlength{\parskip}{\smallskipamount} \setlength{\parindent}{0pt} \usepackage{graphicx} \makeatletter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. \newcommand{\noun}[1]{\textsc{#1}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands. \newlength{\lyxlabelwidth} % auxiliary length %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. \usepackage{polyglossia} \setdefaultlanguage[variant=american]{english} \usepackage{bidi} \errorcontextlines=10 \makeatother \begin{document} \frontmatter \tableofcontents{} \listoffigures \subsection{Event-Space Ephemera} The page of score from the work \noun{Treatise} by Cornelius Cardew, presented in Figure \ref{fig:Page-183-from-cardews-treatise-1}, serves as a practical example of the role secondary or ephemeral score materials may take in the analysis. As is evident from the page, and from other sources among Cardew's \emph{œvre},\footnote{See, for example, the work \noun{Autumn '60}, discussed in some books.} the empty staff lines are provided as a space for performers to record any notations they might deem pertinent to the realization. As already noted, a diligent analysis addresses the specific instance of performance, and this is nonsensical without including whatever notations may have been added by the participants.\footnote{This is, for example, a notable strength of the analysis of David Tudor's realization of \noun{Variations Ⅱ} in another book.} Such ephemera also comprise the additional materials commonly described as sketch and manuscript sources, as well as any documentary materials derived from rehearsal or preparatory work. \begin{figure} \begin{centering} \includegraphics[width=0.45\columnwidth]{/home/elassus/carrier1/Images/not_my_real_mom_cat} \par\end{centering} \caption{\label{fig:Page-183-from-cardews-treatise-1}Page 183 from \noun{Treatise} by Cornelius Cardew} \end{figure} \end{document} ``` ## Expected behavior The document actually compiles to a finished pdf, but compilation fails with the error given at the top. According to the linked thread, this is due to bidi definition of \scr@dte@tocline not having \scr@dte@pagenumberwidth defined before it's used. I can just load the pdf, I guess, from the temp directory, but it'd be nice to get this fixed. I'm writing this with LyX, so some of the document has LyX's internal tex stuff. Thanks for the help, EE
u-fischer commented 4 years ago

Well I agree with the comment that the bidi redefinition is wrong/no longer up-to-date. But looking at the code it seems that the only thing bidi is trying to do is to change every \leftskip/\rightskip to \bidi@leftskip and \bidi@rightskip, so that it can switch their meaning in RTL-context. \bidi@leftskip e.g. is defined like this:

  \newcommand*{\bidi@leftskip}{\if@RTL\rightskip\else\leftskip\fi}

So the first step for a real solution is to make a feature request towards the KOMA-maintainer that he changes in his code every \leftskip/\rightskip to a command version that can be switched by packages like bidi. Then bidi will no longer have to patch anything.