如何制作这样的章节标题

如何制作这样的章节标题

我是LaTEX的初学者,因为一些原因,过几天需要把论文从word改成Latex,请问如何制作这样的章节?非常感谢!!!

在此处输入图片描述

感谢大家的帮助。我知道如何更改章节样式。但我仍然想知道如何在章节后面添加一小段内容。我尝试使用 mintoc 包,但失败了。小目录没有显示。我该如何解决这个问题?谢谢!!!

在此处输入图片描述

\documentclass[twosides]{book}
\usepackage{graphics}
\usepackage{color,calc,graphicx,soul,fourier}
\usepackage{calc}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{minitoc}
\usepackage{tikz}
\usepackage{lipsum}


\titleformat{\chapter}%[display]
{\normalfont\fontsize{25}{30}\selectfont\raggedright}% Format and size of title text
{\llap{%
    \rule[-6pt]{6cm}{1.3cm}\rule{6pt}{0pt}}% Black box to the left, lowered 6pt. The end rule is a horisontal space.
  \llap{% Number also to the left, on top of the black box.
    \fontsize{40}{44}\selectfont\color{white}\thechapter\rule{10pt}{0pt}}}
{0pt}
{}{}

\titlespacing*{\chapter}
  {0pt}{50pt}{10pt}


\setcounter{chapter}{1}

\chapter{A long chapter heading that does not fit in one row}

\begin{document}

\dominitoc
\tableofcontents


\section{A test section}
\lipsum[4]
\subsection{A test subsection}
\lipsum[4]


\minitoc
\end{document}

答案1

像这样吗?

\documentclass[twosides]{book}
\usepackage{graphics}
\usepackage{color,calc,graphicx,soul,fourier}
\usepackage{calc}
\usepackage{titlesec}
\titleformat{\chapter}%[display]
{\normalfont\fontsize{25}{30}\selectfont\raggedright}% Format and size of title text
{\llap{%
    \rule[-6pt]{6cm}{1.3cm}\rule{6pt}{0pt}}% Black box to the left, lowered 6pt. The end rule is a horisontal space.
  \llap{% Number also to the left, on top of the black box.
    \fontsize{40}{44}\selectfont\color{white}\thechapter\rule{10pt}{0pt}}}
{0pt}
{}{}
\usepackage{lipsum}
\setcounter{chapter}{1}
\chapter{A long chapter heading that does not fit in one row}
\begin{document}
\lipsum
\end{document}

在此处输入图片描述

- -编辑 - -

要为每个章节添加目录,您可以使用minitoc以下方法。编译两次。

\documentclass[twosides]{book}
\usepackage{graphics}
\usepackage{color,calc,graphicx,soul,fourier}
\usepackage{calc}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{minitoc}
\usepackage{tikz}
\usepackage{lipsum}
\titleformat{\chapter}%[display]
{\normalfont\fontsize{25}{30}\selectfont\raggedright}% Format and size of title text
{\llap{%
    \rule[-6pt]{6cm}{1.3cm}\rule{6pt}{0pt}}% Black box to the left, lowered 6pt. The end rule is a horisontal space.
  \llap{% Number also to the left, on top of the black box.
    \fontsize{40}{44}\selectfont\color{white}\thechapter\rule{10pt}{0pt}}}
{0pt}
{}{}
\titlespacing*{\chapter}
  {0pt}{50pt}{10pt}
\setcounter{chapter}{1}
\begin{document}
\dominitoc
\tableofcontents

\chapter{A long chapter heading that does not fit in one row}
\minitoc
\section{A test section}
\lipsum[4]
\subsection{A test subsection}
\lipsum[4]

\chapter{Another chapter}
\minitoc
\section{A test section}
\lipsum[2]
\subsection{A test subsection}
\lipsum[2]

\end{document}

在此处输入图片描述

答案2

希望下面的代码可以帮助你使用 minitoc:

 \documentclass[twosides]{book}
    \usepackage{graphics}
    \usepackage{color,calc,graphicx,soul,fourier}
\usepackage{minitoc}
    \usepackage{titlesec}
    \titleformat{\chapter}[display]
      {\normalfont\Large\raggedright}
  {{
\hspace*{-5pc}\colorbox{black}{\vbox to 3pc{\vss\hbox to 5pc{\hss\color{white}\Huge\thechapter}}}
    \MakeUppercase{Literature review}
}}
  {10pt}{\Huge}


\usepackage{lipsum}
\setcounter{chapter}{1}
\dominitoc
\begin{document}
\chapter{Chapter 1}
\minitoc
\section{Chapter 1 First Heading}
\lipsum[1]
\chapter{Chapter 2}
\minitoc
\section{Chapter 2 First Heading}
\lipsum[2]
\end{document}

希望您可以根据您的要求做一些小小的改变......

相关内容