I have a folder tree a little like this, "document.tex" is the root file, section1 is a folder
document.tex
|--[section1]
| |--index.tex
My document.tex code is like that:
\documentclass{article}
\usepackage{currfile}
\newcommand{\insertIndex}[2]
{%
\input{#1#2/index}
}
\begin{document}
\insertIndex{\currfiledir}{section1}
\end{document}
The command throw a error because it say
section1/section1/index.tex" don't exist.
I try a lot and I don't understand why it duplicate the folder
If I view the string #1#2/index without the input the path is correct
\documentclassand the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. – Peter Grill Feb 11 '14 at 00:09section1/section1/index.tex, and it's content was properly displayed. Have you any spaces in your directory/file names? Also, what doesindex.texlook like (i.e., does it have a preamble?). – Peter Grill Feb 11 '14 at 02:25\edef\CurrentFileDir{\currfiledir} \insertIndex{\CurrentFileDir}{section1}things work correctly. I am not very knowledgeable about expansion issues (just know enough to be dangerous :-)) so am hesitant to attempt to explain it. But that should get you going until a proper answer comes along. – Peter Grill Feb 11 '14 at 03:17\newcommand{\insertIndex}[2]{%(note the trailing%. See for instance Tex Capacity Exceeded (if remove % after use of macro). – Peter Grill Feb 11 '14 at 03:21