I would use the adjustwidth
environment from the changepage
package:
\begin{adjustwidth}{<left margin>}{<right margin>}
...
\end{adjustwidth}
The entire contents of adjustwidth
are indented from the left margin by <left margin>
and from the right margin by <right margin>
. Here's a minimal working example:
\documentclass{article}
\usepackage{changepage}% http://ctan.org/pkg/changepage
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}
\section{Some section title inserted here with some custom gibberish}
\begin{adjustwidth}{2.5em}{0pt}
\lipsum[1]
\end{adjustwidth}
\lipsum[2-5]
\end{document}
The standard article
document class indents the section title by 2.5em
.
Edit: After seeing your minimal working example (MWE), I would suggest using the enumitem
package to provide the appropriate margin alignment in your "problem" set. Below is a revised version of your MWE with the correct redefinition.
\documentclass[10pt,a4paper]{article}
\usepackage[hmargin=3cm,vmargin=3.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[norsk]{babel}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage[hidelinks]{hyperref}
\usepackage[dvipsnames*,svgnames]{xcolor}
\newcommand{\oppgave}[2]{\section*{Oppgave #1 {\normalfont\normalsize (#2 poeng)}
\addcontentsline{toc}{section}{Oppgave #1}}}
\newcommand{\del}[1]{%
\item \addcontentsline{toc}{subsection}{#1)}
}
\newlist{deloppg}{enumerate}{2}
\setlist[deloppg]{label=\arabic*),leftmargin=*,itemsep=5pt}
\begin{document}
\tableofcontents
\newpage
\section*{Fasitsvar til regneoppgaver}
\addcontentsline{toc}{section}{Fasitsvar til regneoppgaver}
\newpage
\noindent
\phantomsection
\addcontentsline{toc}{section}{{\color{red}\Large{Del 1}}}
\fcolorbox{black}{LightSteelBlue}{%
\parbox[t][1.25cm][c]{\textwidth}{%
\begin{center}
\textbf{Del 1 \\Uten hjelpemiddler}
\end{center}%
}%
}
\oppgave{1}{18}
\begin{enumerate}[leftmargin=*,labelsep=2em,label=\alph*)]
\del{a} \label{1a}
Vis at den deriverte til funksjonen $O(x) = \dfrac{500}{x} + 8x^2 $ er
%
\begin{align*}
O'(x) = \frac{ -500 + 16x^3 }{x^2}
\end{align*}
%
\del{b} Deriver funksjonene \\
\begin{deloppg}
\item $ f(x) = 3 \ln(2x) $
\item $ g(x) = 3x \cdot e^{x^2} $ \aa
\end{deloppg}
%
\vspace{5mm}
%
\del{c} Vi har gitt polynomfunksjonen $f(x)=x^3 - 3x^2 - 13x + 15$
\begin{deloppg}
\item Vis at $f(1)=0$. Bruk polynomdivisjon til å faktorisere $f(x)$ i førstegradsfaktorer
\item Løs ulikheten $f(x)\leq 0$
\end{deloppg}
%
\vspace{5mm}
%
\del{d}
Mengden av lava som spruter ut per time ved et vulkanutbrudd kan
tilnærmet beskrives ved et funksjonsuttrykk $f(x)$. Funksjonsverdiene
er målt i tonn, og $t$ er antall timer etter begynnelsen av utbruddet. \\ \\ Du får vite at: $f(0)=300, \qquad f'(10)=0 \qquad \textnormal{og} \qquad f''(10) = -10$\\ \\ Hva kan du si om vulkanutbruddet på grunnlag av disse opplysningene?
\end{enumerate}
\end{document}
Looking at your code there could be some improvements made. However, since the MWE might only cover a portion of what you're after, I merely tried to make things work the way you want them to.
Set the \parindent
length to the desired value:
\setlength\parindent{1cm}
A complete example using your code:
\documentclass[12pt]{article}
\setlength\parindent{1cm}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
\end{document}
Best Answer
I give it a try:
Standard Behaviour
The standard paragraph shows an indentation in the first line and no space between paragraphs (
\parskip
is zero).Standard Document Class Solution
You can use the
parskip
package (CTAN link) to solve your problem.From the documentation:
Bad Solution: Manually Change the Lengths
Important for you is that the package
parskip
takes care of other things too. Sometimes you see people manually changing the parameters like\setlength{\parindent}{0em}
and\setlength{\parskip}{1em}
but this is considered bad because it also could change the distance between items in lists and so on. But I am not an expert here.Alternative Solution: KOMA Approach
There are the so called KOMA-Script (CTAN link) document classes (in contrast to the standard document classes like article and book).
They offer a document class option called
parskip
which also "takes care of everything".PS: I don't get the
part of your code.