从章节标题中删除图像

从章节标题中删除图像

我一直使用此代码将图像放在目录中章节标题旁边:

\DeclareRobustCommand\addimg[1]{\llap{\raisebox{-\dp\strutbox}{\includegraphics[height=\baselineskip]{#1} \kern20pt}}}

\chapter[\addimg{en.jpg}Machines d'audit et processus MCO et MCS]{Machines d'audit et processus MCO et MCS}

它工作得很好,但它弄乱了我的标题,正如你在这里看到的: 在此处输入图片描述

我找不到适当的解决方案来保持目录原样并删除图像(或者移动它?)。

这是我的 \fancyhead 定义:

\pagestyle{fancy}
\fancyhead[LE]{\bf \changefont \leftmark} 
\fancyhead[RE]{\thepage}
\fancyhead[LO]{\thepage} 
\fancyhead[RO]{\bf \changefont \leftmark}

谢谢你的帮助 !

分数维:

\documentclass[a4paper,openright]{book} 
\usepackage[utf8]{inputenc}  
\usepackage[T1]{fontenc}      % Format d'encodage
\usepackage[french]{babel}    % Langue français
\usepackage[left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm]{geometry}
\usepackage{multicol}
\usepackage[normalem]{ulem}
\usepackage{shorttoc}
\usepackage{nccrules}
\usepackage{eurosym}
\usepackage{enumerate}
\usepackage{tablists}
\usepackage{multirow}
\usepackage{array}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{longtable}
\usepackage[labelsep=endash]{caption}
\usepackage{arydshln}
\usepackage{hhline}
\usepackage{shapepar}
\usepackage{fancyhdr}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{titlesec}
\usepackage[obeyspaces]{url}
\usepackage{esint} 
\usepackage{varioref}
\usepackage{caption}
\usepackage{textcomp}
\usepackage{sistyle}
\usepackage[titletoc]{appendix}
\usepackage{tikz}
\usepackage[bookmarks=true]{hyperref}
\usepackage{rotating}
\usepackage{csquotes}
\usepackage[backend=biber,style=numeric,sorting=none]{biblatex}
\usepackage{xspace}
\usepackage{floatrow}
\usepackage{placeins}
\usepackage{caption}


\DeclareRobustCommand\addimg[1]{\llap{\raisebox{-\dp\strutbox}{\includegraphics[height=\baselineskip]{#1} \kern20pt}}}

% Table float box with bottom caption, box width adjusted to content
\newfloatcommand{capbtabbox}{table}[][\FBwidth]


\setcounter{tocdepth}{2}

\usetikzlibrary{arrows,shapes,positioning,shadows,trees}
\tikzset{
  basic/.style  = {draw, text width=2cm, drop shadow, font=\sffamily, rectangle},
  root/.style   = {basic, rounded corners=2pt, thin, align=center, fill=green!30},
  level 2/.style = {basic, rounded corners=6pt, thin,align=center, fill=green!60, text width=8em},
  level 3/.style = {basic, thin, align=left, fill=pink!60, text width=6.5em}
}

\newcommand{\addstufftotoc}[2][toc]{% \addimagetotoc[<toc>]{<stuff>}
  \addtocontents{#1}{#2}}

\newcommand{\changefont}{
\fontsize{11}{13}\selectfont
}

\pagestyle{fancy}
\fancyhead[LE]{\bf \changefont \leftmark} 
\fancyhead[RE]{\thepage}
\fancyhead[LO]{\thepage} 
\fancyhead[RO]{\bf \changefont \leftmark}

\fancyfoot{}
\fancypagestyle{nofooter}{%
    \renewcommand{\headrulewidth}{0pt}
    \fancyhead{}
    \fancyfoot{}%
}
\fancypagestyle{noheader}{%
    \renewcommand{\headrulewidth}{0pt}
    \fancyhead{}
    \fancyfoot{}%
}

\titleformat{\chapter}[frame]
{\normalsize}%
{\filright\sffamily\bfseries\Large%
\enspace Chapitre \thechapter\enspace}%
{8pt}
{\rule{0pt}{30pt}\sffamily\Huge\bfseries\filcenter}%

\titleformat{\part}[display]
  {\centering\sffamily\huge}
  {\partname}
  {20pt}
  {\Huge}
  
\setlength{\headheight}{15pt}

\begin{document}

\tableofcontents

\chapter[\addimg{en.jpg}Machines d'audit et processus MCO et MCS]{Machines d'audit et processus MCO et MCS \label{chap:Machinesaudit}}

test
\pagebreak
test

\end{document}

答案1

未经测试,但这应该可行:

\fancyhead[LE]{\renewcommand{\addimg}[1]{}\bf \changefont \leftmark} 
\fancyhead[RE]{\thepage}
\fancyhead[LO]{\thepage} 
\fancyhead[RO]{\renewcommand{\addimg}[1]{}\bf \changefont \leftmark}

相关内容