0

I tried creating a multi-file project as described in overleaf here, but I get this message

main.tex .....Missing \endcsname inserted

and this message

main.tex... Extra \endcsname 

for the line where import is written.

Can someone help? I searched here and a little bit in the documentation of standalone package, but I don't understand what I did wrong. (notes: Some of the foldernames had a gap and somewhere else a middle bar is used for a file name. No pictures in the project. Just simple text. I use texstudio in ubuntu 18.04)

\documentclass{article}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}
\usepackage[utf8]{inputenc}

\usepackage[english, greek]{babel}
\usepackage{color}
%\usepackage{gfsartemisia}
\usepackage[T1]{fontenc}

\usepackage{titlesec}

\title{\textit{ \textbf{TITLE}}}
\author{\Large\textit{AUTHOR}}

\usepackage{graphics}

\definecolor{dg}{rgb}{0.0, 0.0, 1.0}
\definecolor{dr}{rgb}{1.0, 0.13, 0.32}
\definecolor{cerulean}{rgb}{0.0, 0.48, 0.65}
\definecolor{bv}{rgb}{0.8,0.0,0.0}
\usepackage[colorlinks, unicode]{hyperref}

\begin{document}
    
\tableofcontents

\section{Πρόλογος}
\import{HERE/I/PUT/THE/PATH/SOME-NAMES/HAD/A GAP}{INTRODUCTION}

\end{document}

Here is the first sub-file I have made too as a MWE if anyone needs it.

\documentclass[class=extbook, crop=false, 14pt]{standalone}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}
\usepackage[utf8]{inputenc}

\usepackage[english, greek]{babel}
\usepackage{color}
%\usepackage{gfsartemisia}
\usepackage[T1]{fontenc}

\usepackage{titlesec}


\titleformat{\chapter}
{\flushright\normalfont\LARGE\bfseries\color{cerulean} }{\thechapter}{1em}{}
\titlespacing{\chapter}{-18pt}{-102pt}{10pt}


\usepackage{graphics}

\definecolor{dg}{rgb}{0.0, 0.0, 1.0}
\definecolor{dr}{rgb}{1.0, 0.13, 0.32}
\definecolor{cerulean}{rgb}{0.0, 0.48, 0.65}
\definecolor{bv}{rgb}{0.8,0.0,0.0}
\usepackage[colorlinks, unicode]{hyperref}
\begin{document}
Θα ξεκινήσουμε.
\end{document}
4
  • 1
    I would recommend not having file names with a space. But you can try enclosing the file name with double quotes -- that had worked fine for me in the past. Commented Oct 13, 2021 at 15:56
  • 1
    Check CTAN import. I would advise to not use spaces on paths and files. Accordingly to package documentation (and my experience) add a "/" at the end of your path. \import{folder/subfolder/}{fileNoSpaces}.
    – FHZ
    Commented Oct 13, 2021 at 16:25
  • I removed all the gaps and I also put a ```/''' in the end, but the problem remains.@FHZ Commented Oct 17, 2021 at 10:35
  • The names are in greek. I don't know if that is a problem. Commented Oct 17, 2021 at 12:31

1 Answer 1

2

It should be main part (in main.tex for example):

%main.tex
\documentclass{article} 
\usepackage{import}
\usepackage{lipsum}

\begin{document}
    \subimport*{subfolder/}{chapter1}
\end{document}

In this directory or in another but with path to it:

%subfolder/chapter1.tex
\section{Chapter 1}

\input{part1}
%\input{../partA}   % error, doesn't work like that
\subimport*{../}{partA}

And this one:

%/subfolder/part1.tex
\subsection{Part 1}
\lipsum[1]

And Also:

%partA.tex
\subsection{Part A} 
\lipsum[2]
\input{subfolder/part1}

Try to follow this example and it will work like this:

enter image description here

4
  • I don't understand what you mean by "main part" @WinnieNotThePooh Commented Oct 23, 2021 at 8:08
  • 1
    it is Your main tex document Commented Oct 23, 2021 at 9:38
  • Well Ι found after a long time another problem. The answer wasn't working, although the error stopped showing up,and I couldn't find why. the reason was that the file names were in greek. I changed the names in english and now it compiles perfectly. Thanks! Commented Jan 1, 2022 at 17:01
  • @ΝικολέταΣεβαστού always welcome) Commented Jan 1, 2022 at 17:46

You must log in to answer this question.

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