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

Error when subtitle contains absolute value ("pipe") #18

Closed
ChristopherChudzicki opened this issue Oct 18, 2017 · 5 comments
Closed

Error when subtitle contains absolute value ("pipe") #18

ChristopherChudzicki opened this issue Oct 18, 2017 · 5 comments
Assignees
Labels
bug error in the code suggestion suggestions and feature requests

Comments

@ChristopherChudzicki
Copy link

ChristopherChudzicki commented Oct 18, 2017

I'm getting an error when I compile documents where an exercise subtitle contains the pipe | character. Here's a MWE:

% test.tex
\documentclass{article}

\usepackage{xsim}

\begin{document}

\begin{exercise}[subtitle={$|w|$}]
    Hello, world!
\end{exercise}

\end{document}

When I run pdflatex test.tex twice, the second run throws an error:

Runaway argument?
$\q_stop \tl_set_rescan:Nnx \l__xsim_tmpc_tl {}{\l__xsim_tmpc_str }\__xsim_set_
property:VVnV \ETC.
! File ended while scanning use of \__xsim_extract_property_list_entry:NNNwww.
<inserted text> 
                \par 
<*> test.tex

(Although, looking at the generated PDF, the document appears OK. But it makes me nervous.)

@cgnieder cgnieder self-assigned this Oct 19, 2017
@cgnieder cgnieder added bug error in the code suggestion suggestions and feature requests labels Oct 19, 2017
@cgnieder
Copy link
Owner

Hi, thanks. This is not really a bug but should be resolved nonetheless. The problem stems from this. If you have several exercises

\documentclass{article}

\usepackage{xsim}

\begin{document}

\begin{exercise}[subtitle=foo]
  Hello, world!
\end{exercise}
\begin{exercise}[subtitle=bar]
  Hello, world!
\end{exercise}

\end{document}

then you'll find in the aux file lots of lines like this one

\XSIM {subtitle}{exercise-1=={foo}|exercise-2=={bar}}

where the | character is used to separate entries. I'll implement an option so that you'd be able to say

\documentclass{article}

\usepackage{xsim}
\xsimsetup{
  split-aux-lists = ||
}
\begin{document}

\begin{exercise}[subtitle={$|w|$}]
  Hello, world!
\end{exercise}
\begin{exercise}[subtitle=bar]
  Hello, world!
\end{exercise}

\end{document}

@cgnieder
Copy link
Owner

I will also make || the default so hopefully most people will not have to worry about this…
I wonder why you are using | in the first place. From what it looks like I would probably use something like

\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}

and

\begin{exercise}[subtitle={$\abs{w}$}]

@cgnieder
Copy link
Owner

cgnieder commented Mar 7, 2018

This is included in v0.11:

\documentclass{article}

\usepackage{xsim}
\xsimsetup{
  split-aux-lists = ||
}
\begin{document}

\begin{exercise}[subtitle={$|w|$}]
  Hello, world!
\end{exercise}
\begin{exercise}[subtitle=bar]
  Hello, world!
\end{exercise}

\end{document}

@cgnieder cgnieder closed this as completed Mar 7, 2018
@ttnick
Copy link

ttnick commented Oct 11, 2023

I considered opening a new issue but I think this one is closely enough related. A colleague of mine encountered the following error (xsim v0.20c, TeX Live 2022):
File ended while scanning use of \__xsim_extract_property_list_entry:NNNwww.
on every second run of pdflatex, when he uses || within an exercise or solution environment. I believe this is essentially the same issue as the original one here that a || causes xsim to confuse it for a separator in the *.xsim file.
MWE:

\documentclass[a4paper,12pt]{article}
\usepackage{xsim}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\begin{document}
\begin{exercise}
	Consider the following set
	\[
		B(c, r) = \{x \in \mathbb{R}^n \mid ||x - c||_2 \leq r\}.
	\]
\end{exercise}
\end{document}

I told him that that use of || is not good anyway but the error seems strange enough that I thought I report it to you.
(If that matters, there is also notation from scheduling theory that might create the double pipe, e.g. P||C_\max is short for the scheduling problem with multiple machines that wants to minimize the makespan.)

@muzimuzhi
Copy link

@ttnick I would suggest to use either \| or \Vert to typeset double vertical bar. For the problem with ||, see #109.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug error in the code suggestion suggestions and feature requests
Projects
None yet
Development

No branches or pull requests

4 participants