0

As an extension to file ended while scanning use of \path, I tried using path with \iftoggle from etoolbox package.

Below is the error I get

File ended while scanning use of \etb@tgl@BuildC.

Here is MWE:

\documentclass[oneside, a4paper, onecolumn]{memoir}
\usepackage{url}
\usepackage{etoolbox, xcolor}

\let\path\relax \DeclareUrlCommand\path{\color{black!70}\urlstyle{tt}}

\newtoggle{BuildC}

\settoggle{BuildC}{true}

\begin{document}
    \iftoggle{BuildC}%
    {%
        \begin{enumerate}
            \item ABC
            \begin{itemize}
                \item Copy to \path{C:\Applications\}
            \end{itemize}
        \end{enumerate}
}%
{
        \begin{itemize}
            \item DEF
            \begin{enumerate}
                \item Copy to \path{~/Applications/}
            \end{enumerate}
        \end{itemize}
}
\end{document}

This happens only when I use \path within \iftoggle. The document compiles without errors if I remove \path.

EDIT:

Sorry about this edit. It changes things a lot. The MWE and the error has been updated to include file paths. This edit also prevents this question from being a duplicate.

3
  • It does not seem to have anything to do with \iftoggle but rather your use of \color in the new definition of \url. You have not loaded any packages that provide color. Adding xcolor and your MWE compiles for me.
    – daleif
    Commented Aug 8, 2017 at 12:59
  • You still need color access in order to use \color! The main issue here is that \path seems to be interpreting \} in the ABC part. Removing the trailing \ or using \ } and it compiles fine.
    – daleif
    Commented Aug 8, 2017 at 13:42
  • damn!! One of these days, I'm gonna need a paramedic to pry my foot outta my mouth.
    – abyshukla
    Commented Aug 8, 2017 at 13:47

1 Answer 1

2

The main issue in the updated question is

  1. You still ought to use xcolor in order for \color to work, else it is ignored
  2. Using \path inside the argument to other commands may behave strangely. \path{...\} works outside macros but not inside. Here is a simpler example

    \newcommand\test[1]{#1}
    \test{\path{C:\Applications\}}
    

    fails with the same error.

     \test{\path{C:\Applications\ }}
    

    seems to work. So I'm guessing that the \part argument parsing is stumped by \} and thus the scanning for argument never ends.

1
  • Sorry about the edit...
    – abyshukla
    Commented Aug 8, 2017 at 13:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .