Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefining \scr@dte@tocline causes failure with xetex #7

Open
1 of 5 tasks
vafakhalighi opened this issue May 14, 2020 · 2 comments
Open
1 of 5 tasks

Redefining \scr@dte@tocline causes failure with xetex #7

vafakhalighi opened this issue May 14, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@vafakhalighi
Copy link
Contributor


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 has been searched for similar issues?
  • Issue tracker has been searched for similar issues?
  • Links to <tex.stackexchange.com> discussion if appropriate
  • Links to <qa.parsilatex.com> discussion if appropriate

Minimal example showing the issue

\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.

Log and PDF files

@vafakhalighi vafakhalighi added the bug Something isn't working label May 14, 2020
@vafakhalighi vafakhalighi self-assigned this May 14, 2020
@muzimuzhi
Copy link

muzimuzhi commented Jun 17, 2020

A simplified example:

(I am from TeX-SX quesion https://tex.stackexchange.com/q/549846 so table instead of figure is used.)

\documentclass{scrbook}
\usepackage{bidi}

\begin{document}
\contentsline{table}{\numberline {\relax 1.1}{\ignorespaces Table title}}{1}
\end{document}

Compared to the original definition of \scr@dte@tocline in tocbasic.sty, the following change seems to fix the problem.

diff --git a/bidi.dtx b/bidi.dtx
index f0192ef..340a03a 100755
--- a/bidi.dtx
+++ b/bidi.dtx
@@ -21128,6 +21128,8 @@ to\rtside{\box\bslice\hfil}}
           {%
             \normalfont\normalsize\@nameuse{scr@tso@#1@linefill}%
             \nobreak
+            \expandafter\let\expandafter\scr@dte@pagenumberwidth
+            \csname scr@tso@#1@pagenumberwidth\endcsname
             \@nameuse{scr@tso@#1@pagenumberbox}{%
               \@nameuse{scr@tso@#1@pagenumberformat}{#3}%
             }%

Some notes:

With #1 == table in my simplified example, \@nameuse{scr@tso@#1@pagenumberbox}{...} expands to \scr@tso@table@pagenumberbox{...}, then expands to

\hb@xt@ \@nameuse {scr@dte@pagenumberwidth}{\hfil ...}

Here \scr@dte@pagenumberwidth is never defined, hence

\hb@xt@\scr@dte@pagenumberwidth{\hfil ...}

raises error ! Missing number, treated as zero.

@muzimuzhi
Copy link

The proposed change fixes #14 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants