我正在尝试为我的文档添加缩进。每次我想缩进一个段落时,我都会在\hspace*{1cm}
它前面放一个命令。我想在序言中写入一个命令。我发现了,\setlength{\parindent}{1cm}
但它并没有像我想要的那样工作。
不同之处在于,第一个代码中的蓝色分割线也缩进,而第二个代码中则没有。
\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}
您将需要这些样式文件:
collection, moderncv, moderncvcolorblue, moderncvcompatibility, moderncviconsmarvosym, moderncvstyleclassic
我希望我的文档看起来像这样:
\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}
请帮我。
答案1
我已经调整了你的代码,使它看起来像第二个版本,但是对于article
类(关于获取当前字体大小的部分取自这个答案经过大卫·卡莱尔):
\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}
得出的结果为: