我想用一张图片(其中写有章节名称)代替章节名称。但目录中需要以文本形式显示章节名称。
以下代码在章节标题图像前显示空白页。谢谢大家的帮助 :) MWE
\documentclass[12pt,a4paper,fleqn,openany,twoside]{book}
%
\usepackage{subfiles}
\usepackage{TB_bookstyle}
%%%%%
%
\begin{document}
%
\newgeometry{textwidth=\paperwidth, textheight=\paperheight, noheadfoot, nomarginpar}
\chapter*{\tiny{\color{white}{Messages}}}
\addcontentsline{toc}{chapter}{Messages}
%\addtocounter{chapter}{1}
\begin{figure}[h]
\centering
\includegraphics[width=1.0\textwidth]{./images/Chap_Msgs}
\end{figure}
\end{document}
自制样式文件:
\ProvidesPackage{TB_bookstyle}
%
%%% PAGE DIMENSIONS AND SETTINGS
\usepackage{geometry} % to change the page dimensions
\geometry{a4paper} % or letterpaper (US) or a5paper or....
%\geometry{margin=1.5in} % for example, change the margins to 2 inches all round
\geometry{top=0.8in, bottom=0.8in, left=1.0in, right=1.0in}
% \geometry{landscape} % set up the page for landscape
% read geometry.pdf for detailed page layout information
%
%%%%GRAPHICS, FLOATS, SYMBOLS AND MATHS
% support the \includegraphics command and options
\usepackage{graphicx}
%\usepackage{booktabs} % for much better looking tables
\usepackage{floatrow}%for side captions
\usepackage[utf8]{inputenc}%for proper characters
% for rotating floats
\usepackage{lscape}
%for subfigures and tables
\usepackage[font=small,labelfont=bf]{caption}
%\usepackage{subcaption}
\usepackage[font=footnotesize]{subfig}
\usepackage[para,online,flushleft]{threeparttable}
\usepackage{array}
\usepackage{tabularx}
\usepackage{booktabs}
\newcolumntype{b}{X}
\newcolumntype{s}{>{\hsize=.5\hsize}X}
\usepackage{longtable}%for long tables
%%%
\usepackage{amsmath,amssymb}
%%
\usepackage[allcolors=black,colorlinks=true]{hyperref}%no boxes for links
\usepackage[noabbrev,capitalize]{cleveref}%automatic table /figure before refs
\creflabelformat{equation}{#2\textup{#1}#3}%remove brackets around eq nos
%%%
\usepackage[osf,sc]{mathpazo} %for upright math
\usepackage{eulervm}
\usepackage{gensymb}
\usepackage{textcomp}
\usepackage{wasysym} %for per mil sign
\usepackage{array} % for better arrays (eg matrices) in maths
\usepackage{paralist}
\usepackage{enumitem}% very flexible & customisable lists (eg. enumerate/itemize, etc.)
\usepackage{verbatim} % adds environment for commenting out blocks of text & for better verbatim
\usepackage{subfig} % make it possible to include more than one captioned figure/table in a single float
\usepackage[version=3]{mhchem} % for upright CO2 etc
\usepackage{wrapfig}%text wrapped figures/tables
%%
\usepackage{calligra}%For cursive font
\usepackage[T1]{fontenc}
\usepackage{blindtext, color}
\definecolor{brown}{rgb}{0.5, 0.2, 0.0}
\definecolor{cornellred}{rgb}{0.7, 0.11, 0.11}
\definecolor{brown_w}{rgb}{0.65, 0.16, 0.16}
\usepackage{titlesec}
%\titleformat{\chapter*}[hang]{\tiny\bfseries}{\thechapter\hsp\textcolor{white}{|}\hsp}{0pt}{\tiny\bfseries}
%\titleformat{\chapter}[hang]{\normalfont\Large\bfseries}{\chaptertitlename\ \thechapter:}{1em}{}
\titlespacing{\chapter}{-20pt}{-20pt}{-20pt}
\titlespacing{\section}{0pt}{0pt}{5pt}
\titlespacing{\subsection}{0pt}{0pt}{5pt}
\titlespacing{\subsubsection}{0pt}{0pt}{5pt}
%to stop starting new chapter in new page
\usepackage{atbegshi,etoolbox}
%%
%%% HEADERS & FOOTERS
\usepackage{fancyhdr} % This should be set AFTER setting up the page geometry
%\setlength{\headheight}{50pt}
\pagestyle{empty} % options: empty , plain , fancy
%%
%%% ToC (table of contents) APPEARANCE
\usepackage[nottoc,notlof,notlot]{tocbibind} % Put the bibliography in the ToC
%%%%
%\renewcommand{\cftsecfont}{\rmfamily\mdseries\upshape}
%\renewcommand{\cftsecpagefont}{\rmfamily\mdseries\upshape} % No bold!
%\usepackage{tocloft} % Alter the style of the Table of Contents
\setcounter{tocdepth}{4}
\renewcommand{\bibname}{References}
%\usepackage{bibentry}%for no ref list
%made command
%\makeatletter
%\newcommand*{\toccontents}{\@starttoc{toc}}
%\makeatother
%\renewcommand{\contentsname}{}
%%%%%%%
%
%\usepackage[colon,authoryear]{natbib}
%
%mytilde
\newcommand{\mytilde}{\raise.17ex\hbox{$\scriptstyle\mathtt{\sim}$}}
%%%