# Indenting text from '\enumerate'

I am trying to write a document that has the same question in two places. So, I've written that question down in a seperate tex file, and used the \input command in both places to copy the question.

However, the question has parts (a, b, c) and I would like each part to have its own, seperate tex file. Once I have done so, I used the \input command twice, once for the original quetsion, and the second for the respective part.

Here is the minimal main.tex file used in this project:

\documentclass[12 pt]{book}
%____________________________Packages____________________________________
\usepackage{import} % For large project management
\usepackage[shortlabels]{enumitem} % For enumeration and lists
\usepackage[margin=1 in]{geometry} % Adds 1 inch margins

%___________________________Page Style_______________________________________________
\setlength{\parindent}{0cm} % Removes all indentation
\newcommand{\tab}{\hspace*{1cm}}
% __________________________________Body__________________________________
\begin{document}

\include{Problem_1a}

\end{document}


Here is what Question_1.tex file contains:

\begin{enumerate}
\item[1.]
Some question \#1.
\end{enumerate}


Here is what Question_1a.tex file contains:

\begin{enumerate}
\item[a.]
Some part 1a.
\end{enumerate}


And, finally, here is the code in question, contained in Problem_1a.tex:

\import{./}{Question_1}
% \tab\import{./}{Question_1a}
\tab{}\input{Question_1a}

\textit{Solution.}
\newline


which generates:

However, the '\input' command (also the \import command) seems to create a new line automatically, and even if I put a '\tab' command (that I've written as a macro) it will skip that line and create another.

This is how I want the final result to look like.

But that was only accomplished manually by:

\begin{enumerate}[1.]
\item
Some question \#1.
\begin{enumerate}[a.]
\item
Some part 1a.
\end{enumerate}
\end{enumerate}


How do I force the input command to indent the text it contains (also without creating additional space)?

Note: I don't want to use \input{Question_1a} within Question_1.tex because I want to use Quesiton_1.tex seperatley elswhere within the document.

• In my experience, \import or \input introduce only a space afterwards, not a new line. Are there blank lines at the start or end of the file you're inputting/import? Can you post a complete minimal working example, including the definition of \tab, along with a sample inputted file for it that generates this problem? In general, you should always post code, never screenshots of code. May 18 at 1:03
• Isn't the obvious solution here is to (correctly) do the \input of 1a inside Question_1.tex.instead? May 18 at 1:31
• (like how you would type it by hand manually. What's the issue?) May 18 at 1:31
• This is not a minimal working example, as it is nowhere near minimal. Please read the page I linked in my previous message. But I'm pretty sure your problem has nothing to do with \input or \import. You'd get the same result if you copied and pasted the results. The enumerate environment starts a new paragraph. You can't indent it that way. May 18 at 1:44
• Is it that you don't want to put the \input for Question_1a.tex inside Question_1.tex (As user202729 suggests) because you sometimes want to use Question_1.tex without including the solution? Rather than trying to emulate an enumerate inside an enumerate with a tab, you could put the \input for Question_1a.tex in Question_1.tex but inside a boolean conditional.See here. There are also classes specializing in problems and solutions with builtin mechanisms for this like xsim and exercise. May 18 at 2:00

Instead of trying to force the text from the \input command to be indented, I was able to use the enumerate environment within Question_1a.tex to make it appear as if it was indented. The Question_1a.tex was modified to be:

\begin{enumerate}[\empty]
\item
\begin{enumerate}
\item[a.]
Some part 1a.
\end{enumerate}
\end{enumerate}


This produced the output:

as desired.

I'm guessing there is a better enviroment that is more suited to create this indentation, so if anyone knows of it, let me know in the comments.