我想获得如下章节的风格:
\documentclass[12pt,a4paper]{report}
\usepackage{fancyhdr}
\pagestyle{fancy}
\rhead{\textbf{\thepage}}
\lhead{\textsl{\nouppercase{\leftmark}}}%
\setlength{\headheight}{14.5pt}
\begin{document}
\chapter*{Thanks}
\chapter{Chapter one}
\begin{thebibliography}{999}
\newpage
\bibitem{axlupol}{O. Axelsson, H. Lu, B. Polman,} {On the numerical radius of matrices and its application to iterative solution methods,} Linear Multilinear Algebra 37 (1994) 225-238.
\end{thebibliography}
\end{document}
我的目标是获得
答案1
使用 Ti 的尝试钾Z:
\documentclass{report}
\usepackage[margin=3cm]{geometry}
\usepackage[explicit]{titlesec}
\usepackage{tikz}
\usetikzlibrary{positioning}
\titleformat{\chapter}{}{}{0pt}{
\begin{tikzpicture}
\fill[black] (-0.7,-2) rectangle (0.7,2);
\draw[color=white] (0,1) node {\bfseries\Huge\thechapter};
\draw (0,2.5) node {\Large Chapter};
\draw (1,0)--(13,0);
\coordinate (start) at (1,0);
\node[below right=5mm and 0cm of start.center] {\bfseries\Huge #1};
\end{tikzpicture}
}
\begin{document}
\chapter{Introduction}
\end{document}
你不应该使用它\chapter*{}
,因为它不起作用!相反,试试这个代码:
\documentclass{report}
\usepackage[margin=3cm]{geometry}
\usepackage[explicit]{titlesec}
\usepackage{tikz}
\usetikzlibrary{positioning}
\titleformat{\chapter}{}{}{0pt}{
\begin{tikzpicture}
\fill[black] (-0.7,-1.5) rectangle (0.7,1.5);
% Change to \fill (-0.7,-2) rectangle (0.7,2); if you want the black rectangle to be longer
\draw[color=white] (0,0.5) node {\bfseries\Huge\thechapter};
% Change to (0,1) if the black rectangle is changed in \fill
\draw (0,2) node {\Large Chapter};
% Change to (0,2.5) if the black rectangle is changed in \fill
\draw (1,0)--(13,0);
\coordinate (start) at (1,0);
\node[below right=5mm and 0cm of start.center] {\bfseries\Huge #1};
\end{tikzpicture}
}
\begin{document}
\chapter{Introduction}
\newpage
\begin{tikzpicture}
\fill[black] (-0.7,-1.5) rectangle (0.7,1.5);
% Change to \fill (-0.7,-2) rectangle (0.7,2); if you want the black rectangle to be longer
\draw (1,0)--(13,0);
\coordinate (start) at (1,0);
\node[below right=5mm and 0cm of start.center] {\bfseries\Huge Thanks!};
\end{tikzpicture}
\end{document}
虽然你会添加一段不那么短的代码,但我认为这是可以的。因为当\chapter
以这种方式定义时,\thechapter
被放置在 Ti钾Z图,因此\chapter*
失去了它本身的功能。
如果你能将我的答案改进为更好的答案,你的编辑,或者更确切地说,你的答案将不胜感激!