Main.tex …..Missing \endcsname inserted , Extra \endcsname

errorsstandalone

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}

Best Answer

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

Related Question