我使用titlesec
包来生成一个占据整个纸张宽度的部分样式。当我maginfigure
在包中使用环境时tufte-book
,有时我的图形和我的部分会重叠。
我怎样才能防止这种情况发生?
\documentclass[11pt,fleqn]{biditufte-book}
% add numbers to chapters, sections, subsections
\setcounter{secnumdepth}{2}
\usepackage{ptext}
\usepackage{tikz}
\usepackage{xepersian}
\settextfont{Tahoma}
%----------------------------------------------------------------------------------------
% SECTION STYLING
%----------------------------------------------------------------------------------------
\newlength\outermargin
\newlength\innermargin
\setlength{\innermargin}{1in}
\setlength{\outermargin}{\dimexpr\paperwidth-\textwidth-\innermargin\relax}
\titleformat{\section}%
{\normalfont\Large\color{purple}\setlength\fboxrule{0.8pt}}% format applied to label+text
{\llap{\colorbox{red}{\makebox[\outermargin][l]{\raisebox{0pt}[\dimexpr\height+\fboxrule][\dimexpr\depth+\fboxrule]%
{\vphantom{lp}\color{white}\bfseries\thesection\enspace}}}}}% label
{0pt}% horizontal separation between label and title body
{\rlap{\hspace{-\fboxrule}\framebox[\dimexpr\linewidth + 2\fboxrule\relax][l]{\vphantom{lp}}\colorbox{orange}{\makebox[\outermargin][l]{\raisebox{0pt}[\dimexpr\height+\fboxrule][\dimexpr\depth+\fboxrule]%
{\vphantom{lp}}}}}\enspace}% before the title body
[]
\begin{document}
\chapter{فصل}
\section{مقدمه}
\begin{marginfigure}
\includegraphics[width=\linewidth]{example-image-a}
\caption{This is a margin figure. The helix is defined by $x = \cos(2\pi z)$, $y = \sin(2\pi z)$, and $z = [0, 2.7]$.}
\label{fig:marginfig}
\end{marginfigure}
\ptext[4]
\subsection{معرفنامه}
\ptext[1-10]
\section{سرانجام}
\end{document}