0
\documentclass[a4paper]{article}

\usepackage{comment}
\usepackage[trim]{tokenizer}
\usepackage{ifthen}
\usepackage{xargs}
\usepackage{xkeyval}
\usepackage{xfor}

\begin{document}
\makeatletter


\def\bb{\compilation} % \combilation has {one,two,three}

\newcommand{\chapterInputa}[4][all

]{%

% It does not work 

  \def\SourceA{\bb}
    \whiledo{\not\equal{\SourceA}{}}
    {
        \GetTokens{TokenOneA}{TokenTwoB}{\SourceA}
            BB TOken- \TokenOneA \\
        \let\SourceA\TokenTwoB
    }

% its work fine

  \def\Source{#1}
    \whiledo{\not\equal{\Source}{}}
    {
        \GetTokens{TokenOne}{TokenTwo}{\Source}
            ELE- \TokenOne \\
        \let\Source\TokenTwo
    }


\chapter{#3\label{#4}}
    \input{#2}
}

}
\makeatother
\end{document}

The change in two code is passing parameter as #1 and variable name. What's wrong with the code.

5
  • A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). Apr 12, 2013 at 14:49
  • Please edit your code so that it starts with \documentclass and shows all packages used. As posted it uses several non standard commands with no indication of where or how they are defined, so there is not much help we can offer. Apr 12, 2013 at 14:51
  • 1
    In the first \whiledo \SourceA is expanded to \bb first. Then \bb is expanded to \compilation, but the latter is undefined. Apr 12, 2013 at 16:14
  • 2
    As posted your code produces ! Too many }'s. l.45 } If the spurious } is deleted then the example runs without error. However it doesn't use any of the macros it defines and you haven't said what you intend those macros to do so it is still impossible to guess what help you are looking for. Apr 12, 2013 at 21:29
  • I wanted to compare two comma separated list. If the two list has at least one same element then it should load the chapter " \chapter{#3\label{#4}} \input{#2}"
    – BusyBee
    Apr 12, 2013 at 22:04

0

Browse other questions tagged .