I'm trying to have recursive path in the command \input@path, but it seems to be impossible (as I read, I'm with the TexLive 2012 and Linux).

So I had the following idea, make a loop in \input@path, but it doesn't work and I don't know why ...

This is what I did :

  \ifcase\thepath Cours%
  \or Livres%
 \loop \ifnum \thepath<3
 \stepcounter{path} \repeat

If someone have an idea, it will be very helpful.

  • 1
    Welcome to TeX.SX! Please add a fully compilable minimal working example (MWE) that illustrates your problem. In particular it is not obvious what you are trying to achieve. Maybe you could provide some context? – bodo Aug 26 '12 at 16:33
  • Thx for the welcome ... For the MWE, it is a little difficult, but I can try. Just try to explain better (sorry for my english, I'm french). So what I want it's to make a loop in input@path (to make a minimal code in input@path, I have a lot of directories), so when I do an \input{foo} in my main file, Latex can find my foo.tex everywhere... I don't know if it better ? – Coyote Aug 26 '12 at 17:11
  • 1
    If you really have a lot of directories, then it might be adviseable to put the root of all of them into TEXMFHOME and run texhash to index all of them. Run texdoc texlive for infos on configuration. These variables are not strictly meant for this sort of thing, but by putting a large number of items in input@path, you are forcing LaTeX to explicitly iterate through all of them for every input, which can get time consuming. – Stephan Lehmke Aug 26 '12 at 17:24

The format of \input@path is fixed, each path entry is surrounded by curly braces without further separators. Any other stuff such as loops are forbidden. But it is possible to add entries:

    Cours% 0
    Livres% 1
    Two% 2
\ifnum\value{path}<3 %
\typeout{input@path: \input@path}

Some remarks:

  • The input strings are expanded by \edef, because sooner or later they are expanded anyway. The tilde ~ is usually an active character, to prevent expansion, it is prefixed by \string that converts the active to a non-active character (with catcode 12).

  • The example uses \value{<counter>} instead of \the<counter>, because the latter form is intended for printing and might not always expand to a plain arabic number.

  • The definition for number 2 in \ifcase was missing.

  • Wonderful :-) That's works perfectly ! Sorry for the number two and ~, it was very bad mistakes, please accepts my excuses. For the difference between \value{<counter>} and \the{<counter>}, I don't understand ! \the<counter> can produce roman or alpha counter, isn't it ? And `\value{<counter>}è is always arabic ? In all case, a great thx for your help ! – Coyote Aug 26 '12 at 19:31
  • I guess it is the same for \graphicspath ? Or may be not ? – Coyote Aug 26 '12 at 20:00
  • Yes, \graphicspath and \input@path use the same data format. – Heiko Oberdiek Aug 26 '12 at 20:11
  • \value{<counter>} is the counter register, whereas \the<counter> is the counter representation, as default an arabic number that might be redefined. – Heiko Oberdiek Aug 26 '12 at 20:21
  • Thx again for yours answers .... I take your code and change input@path by graphicspath and \input@path by \graphicspath ... but it doesn't work, I have this : !Argument of \graphicspath has an extra }. Damn it ! – Coyote Aug 26 '12 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.