2

I'm trying to add indentation to my documentation. Every time I wanted to indent a paragraph I put a \hspace*{1cm} command before it. I want to write a command into the preamble. I found \setlength{\parindent}{1cm} but it doesn't work as I want.

The difference is the blue section line is indented too in the first code, while in the second code it isn't.

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvtheme[blue]{classic}
\usepackage[top=2.0cm, bottom=3.8cm, left=2cm, right=2cm]{geometry}

\AtBeginDocument{\setlength{\headsep}{1.5cm}}
\usepackage{fancyhdr}
\pagestyle{fancy}

\setlength{\hintscolumnwidth}{4.0cm}
\firstname{Homework}
\familyname{}
\title{Samyfarha}

\makeatother

\setlength{\parindent}{1cm}

\cfoot{Samyfarha}
\rfoot{\thepage}

\begin{document}
\maketitle
\begin{center}
\textbf{Dokumentation}
\end{center}
\section{Section}
In 1900, his paper "Folgerungen aus den Capillaritätserscheinungen ("Conclusions from the Capillarity Phenomena") was published in the prestigious Annalen der Physik On 30 April 1905, Einstein completed his thesis, with Alfred Kleiner, Professor of Experimental Physics, serving as pro-forma advisor. 

\end{document}

You will need these style files: collection, moderncv, moderncvcolorblue, moderncvcompatibility, moderncviconsmarvosym, moderncvstyleclassic

And I want my documentation looks like this:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvtheme[blue]{classic}
\usepackage[top=2.0cm, bottom=3.8cm, left=2cm, right=2cm]{geometry}

\AtBeginDocument{\setlength{\headsep}{1.5cm}}
\usepackage{fancyhdr}
\pagestyle{fancy}

\setlength{\hintscolumnwidth}{4.0cm}
\firstname{Homework}
\familyname{}
\title{Samyfarha}

\makeatother

%\setlength{\parindent}{1cm}

\cfoot{Samyfarha}
\rfoot{\thepage}

\begin{document}
\maketitle
\begin{center}
\textbf{Dokumentation}
\end{center}
\section{Section}
\hspace*{1cm}In 1900, his paper "Folgerungen aus den Capillaritätserscheinungen ("Conclusions from the Capillarity Phenomena") was published in the prestigious Annalen der Physik On 30 April 1905, Einstein completed his thesis, with Alfred Kleiner, Professor of Experimental Physics, serving as pro-forma advisor. 

\end{document}

Please, help me.

  • Welcome to TeX.SE – Romain Picot Dec 2 '15 at 10:55
  • 2
    Is this your CV? If not I would strongly suggest not using the moderncv class. You shouldn't need \hspace in the document. By default the first paragraph of a section is not indented, you can change that by adding \usepackage{indentfirst} – David Carlisle Dec 2 '15 at 11:00
  • This isn't my cv. I've written documents in this class for 3 years. I like the structure of this class. Could you help me remake it in article class? – Erzsébet Romsics Dec 2 '15 at 11:11
2

I have adapted your code to look like the second version, but for the article class (the part about getting the current font size is taken from this answer by David Carlisle):

\documentclass[11pt,a4paper,sans]{article}
\usepackage{cmbright} % the font
\usepackage{xcolor} % for defining the color of the rule before the section
\usepackage{titling} % for customizing the title
\usepackage{titlesec} % for customizing sections
\usepackage[top=2.0cm, bottom=3.8cm, left=2cm, right=2cm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}

\newlength{\mytextsize} % for getting the current font size

\makeatletter
\setlength{\mytextsize}{\f@size pt} % this stores the current font size
\makeatother

\title{Homework} % now the title is really specified as the title
\author{Samyfarha} % and the author as the author
\date{} % if you would like to specify a date, further customization is required

\cfoot{Samyfarha}
\rfoot{\thepage}

\pretitle{\noindent\bfseries\fontsize{3\mytextsize}{3\mytextsize}\selectfont} % big and bold title
\preauthor{\LARGE\color{gray}\itshape} % still big, but not as big author in gray and italics
\posttitle{\\[1ex]} % a bit space below the title
\postauthor{\\[1ex]} % a bit space below the author

\titleformat{\section}{\Large}{\thesection}{1em}{\color{cyan!50!blue}\rule[0.3ex]{4cm}{0.7ex}\hspace*{1em}} % add blueish rule in front of section title
\titlespacing{\section}{0pt}{*1}{*1} % enable indentation of paragraph after section title

\begin{document}
\maketitle
\begin{center}
\textbf{Dokumentation}
\end{center}
\section*{Section} % now you need to use the starred variant if you do not want a number
In 1900, his paper ``Folgerungen aus den Capillarit\"atserscheinungen'' 
(``Conclusions from the Capillarity Phenomena'') was published in the 
prestigious Annalen der Physik On 30 April 1905, Einstein completed his thesis, 
with Alfred Kleiner, Professor of Experimental Physics, serving as pro-forma 
advisor. 

\end{document}

This produces:

enter image description here

  • @ErzsébetRomsics No worries. However, on this site you should not write comments or answers that only contain a "Thank you". Instead, you can accept the answer if it solves the problem and (as soon as you have enough reputation) you can upvote answers (and questions) that you consider useful. – cryingshadow Dec 6 '15 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.