So I have this user defined function below. This gives me near optimal results. The code is supposed to make numbered subsections. Where the rest of the text is aligned below. Since these subsections usually only span over 1-3 lines, this looks good.
\documentclass[10pt,a4paper]{article}
\usepackage[hmargin=3.5cm,vmargin=2cm]{geometry}
\usepackage{lipsum}
\newcounter{problem}
\setcounter{problem}{0}
\newcounter{navn}[problem]
\renewcommand{\thenavn}{\alph{navn}}
\newcommand{\navn}{ \stepcounter{navn} \hspace{ -0.12cm} \bfseries \thenavn) }
\setcounter{navn}{0}
\newcommand{\NR}[1]
{ \vspace{5mm} \begin{minipage}[t]{0.051 \textwidth}
\navn \hspace{0pt}
\end{minipage}
\begin{minipage}[t]{0.949\textwidth}
#1
\end{minipage}
\vspace{-0.3cm}
\addcontentsline{toc}{subsubsection}{\textnormal{ \thenavn })}
}
\newcommand{\UR}[1]
{ \begin{minipage}[t]{0.051 \textwidth}
\hspace{0pt}
\end{minipage}
\begin{minipage}[t]{0.949\textwidth}
#1
\end{minipage}\vspace*{-0.4cm}
}
\setlength{\parindent}{0in}
\begin{document}
\NR{\lipsum[1]}
{\lipsum[5]}
\UR{\lipsum[2]}
\NR{Hello}
\[ x^2 + 3x + 4 \]
\NR{Problems}
\NR{Problems}
\lipsum[3]
\end{document}
Now, after compiling this code. One can clearly see that the text beneath the \NR
command is coming to close to the actual text. Of course this is caused by the negative spacing inside the command. However this code is needed otherwise the spacing between the \NR
command, and following images are far to large.
Also the spacing regarding functions increases too much.
One can also see in the code, that the length of the command is set by default.
The spacing in my MWE between c) and e) Is perfect. I know I can use \\
to increase the spacing, but this gets tedious and is against the spirit of Latex.
My question now is how do I properly define the spacing? More specifically:
How do I define that the minipages, should always start at the width of the page, with a default indent?
How do I properly define the horizontal space before and after the command? (So that it is the same as in the MWE but also fixes the normal text problem)
enumerate
environment does not work for you? If you want to consider that I would use theenumitem
package. See what are the differences between using paralist vs enumitemenumerate
andresume
it after. Is there something other than indentation that you are trying to accomplish with theseminipages
?