我正在写一份报告,希望实现两件事;
- 我的文档中每段的段落编号,例如 1.、2. 等等。
- 将段落编号和章节编号添加到左边距,并将文本和章节标题对齐
因为它是一个很大的文档,所以我想使用“\input{example.txt}”选项将我的内容拉入文档,理想情况下不必在 example.txt 文件中包含任何“\paragraph”标识符,只需包含文本块。
谁能告诉我我哪里做错了?
我是 Latex 的新手,所以请随时指出任何新手错误 - 假设我什么都不知道,你不会错得太远 :)
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{newtxmath,newtxtext}
\usepackage[utf8]{inputenc}
\newlength{\alphabet}
\settowidth{\alphabet}{\normalfont abcdefghijklmnopqrstuvwxyz}
\usepackage[textwidth=2.5\alphabet]{geometry}
\frenchspacing
\usepackage[none]{hyphenat}
\newcommand{\sectionbreak}{\clearpage}
\usepackage{indentfirst}
\usepackage{datetime}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage[dvipsnames]{xcolor}
\usepackage{titlesec}
\usepackage{lastpage}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\newcommand{\changefontleft}{%
\fontsize{10}{12}\selectfont
}
\newcommand{\changefontcenter}{%
\fontsize{16}{19}\selectfont
}
\newcommand{\changefontright}{%
\fontsize{10}{12}\selectfont
}
\fancyfoot[RO,LE] {\thepage \hspace{1pt} of \pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\usepackage{chngcntr}
\counterwithout{paragraph}{subsubsection}
\renewcommand{\theparagraph}{\arabic{paragraph}.}
\setcounter{secnumdepth}{4}
\usepackage{titlesec}
\titleformat{\paragraph}[runin]{\normalfont}{\theparagraph}{\wordsep}{}
\titlespacing{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{\wordsep}
\begin{document}
\section{Report}
\input{input.txt}%
\subsection{Details}
\lipsum[1-2]
\subsection{Garage}
\lipsum[1-2]
\section{Bedrooms}
\lipsum[1-2]
\subsection{Bathrooms}
\lipsum[1-2]
\section{Toilets}
\lipsum[1-5]
\end{document}
input.txt 只包含如下纯文本段落;
If you're an influencer or content creator, you might not think you need to worry about business plans and executive summaries.
Executive summaries can help you convince investors, venture capitalists, and the brands you approach for partnerships and sponsorship agreements that you're worth the investment.
Executive summaries aren't written in stone.
谢谢