侧注包的图形*(宽图)的标题在双面文档中有错误的边距或宽度

侧注包的图形*(宽图)的标题在双面文档中有错误的边距或宽度

在双面文档中,figure*偶数页上的(宽图)标题的宽度和边距不正确。

\documentclass[11pt,a4paper,twoside]{article}

\usepackage{graphicx}

\usepackage{caption}
\usepackage{sidenotes} %% To typeset the rich content in the margin. It also loads caption package.
\DeclareCaptionStyle{widefigure}{format=plain,font=normalsize,labelfont=bf,textfont=up,labelsep=period}

\begin{document}

\begin{figure*}[!t]
\centering
\fbox{\includegraphics[width=0.98\linewidth]{fig}}
\caption{(a) The electric field vector of linearly polarised monochromatic light,
travelling along $z$, at a given instant of time. The 
entire pattern moves past any given plane, say $z=0$; so the time
variation would be the same curve read in reverse, with the part at
positive $z$ arriving earlier. The magnetic field B is shown
only at one plane, $z=0$, but is equal to the electric field (in
cgs units!) but along $y$.}
\end{figure*}

xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx 

\marginpar{xxx x x xx xxxx xx xxx xxxxx zx}


\newpage

\begin{figure*}[!t]
\centering
\fbox{\includegraphics[width=0.98\linewidth]{fig}}
\caption{(a) The electric field vector of linearly polarised monochromatic light,
travelling along $z$, at a given instant of time. The 
entire pattern moves past any given plane, say $z=0$; so the time
variation would be the same curve read in reverse, with the part at
positive $z$ arriving earlier. The magnetic field B is shown
only at one plane, $z=0$, but is equal to the electric field (in
cgs units!) but along $y$.}
\end{figure*}


xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx 

\marginpar{xxx x x xx xxxx xx xxx xxxxx zx}



\end{document}

以下结果在奇数页。

在奇数页

以下结果在偶数页上。

在偶数页

答案1

我在 Gitlab 上向 Caption 包作者 Axel Sommerfeldt 报告了这个问题。他有一个解决这个问题的变通方法,并修复了它(在 Gitlab 上提交 cc7fb506) 并更新了托管在 Gitlab 中的包。他说更新将于下周在 CTAN 中提供。您也可以通过从以下位置复制文件来更新您的 caption 包https://gitlab.com/axelsommerfeldt/caption/-/tree/master/tex进入文件caption.sty当前在 TeX 系统上的目录。要了解位置,caption.sty请使用以下命令。

$ kpsewhich caption.sty

或者使用您知道的任何其他方法(如 TexLive 管理器tlmgr)从 CTAN 更新包(下周)。

正如他指出的那样,问题在于使用adjustwidth来自包的环境changepage,该sidenotes包正在使用该环境来排版宽图。他有一个解决方法来检测标题是否在adjustwidth环境中并适当地设置标题代码。他还建议

另外,您可以将\hsize=\linewidth受影响的数字作为解决方法放入其中。

更新caption包或将受影响的图形放入其中作为临时解决方案\hsize=\linewidth还有一个额外的优势。在修复任何这些问题后,请针对上面给出的相同示例尝试以下设置,然后亲自查看。

\usepackage{sidenotes} %% To typeset the rich content in the margin. It also loads caption package.
\newlength{\xtramargin}
\setlength{\xtramargin}{\dimexpr \marginparsep +\marginparwidth}
\DeclareCaptionStyle{widefigure}{format=plain,font=normalsize,labelfont=bf,textfont=up,labelsep=period,
    margin={0cm,\xtramargin},twoside}

有关此问题的更多详细信息:

答案2

代码的输出显示,无论是奇数页还是偶数页,标题都与图形的左边缘对齐,并且宽度等于文本的宽度。

如果你想放大标题,请figure*添加此代码

\newlength{\xtramargin}
\setlength{\xtramargin}{\dimexpr \marginparsep +\marginparwidth}
\DeclareCaptionStyle{widefigure}{format=plain,font=normalsize,labelfont=bf,textfont=up,
    labelsep=period, margin={0cm,-\xtramargin},oneside }

更改标题的边距。

A

这是完整的代码。

\documentclass[11pt,a4paper,twoside]{article}

\usepackage{graphicx}

\usepackage{showframe}% only to show the margins <<<<<<<<<<<

\usepackage{sidenotes} %% To typeset the rich content in the margin. It also loads caption package.

%% ************************************************* added
\newlength{\xtramargin}
\setlength{\xtramargin}{\dimexpr \marginparsep +\marginparwidth}
\DeclareCaptionStyle{widefigure}{format=plain,font=normalsize,labelfont=bf,textfont=up,
    labelsep=period, margin={0cm,-\xtramargin},oneside }
%% ************************************************

\begin{document}    
    
    \begin{figure*}[!t]
        \centering
        \fbox{\includegraphics[width=0.98\linewidth]{example-image}}
        \caption{(a) The electric field vector of linearly polarised monochromatic light,
            travelling along $z$, at a given instant of time. The 
            entire pattern moves past any given plane, say $z=0$; so the time
            variation would be the same curve read in reverse, with the part at
            positive $z$ arriving earlier. The magnetic field B is shown
            only at one plane, $z=0$, but is equal to the electric field (in
            cgs units!) but along $y$.}
    \end{figure*}
    
    xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx 
    
    \marginpar{xxx x x xx xxxx xx xxx xxxxx zx}
    
    
    \newpage
    
    \begin{figure*}[!t]
        \centering
        \fbox{\includegraphics[width=0.98\linewidth]{example-image}}
        \caption{(a) The electric field vector of linearly polarised monochromatic light,
            travelling along $z$, at a given instant of time. The 
            entire pattern moves past any given plane, say $z=0$; so the time
            variation would be the same curve read in reverse, with the part at
            positive $z$ arriving earlier. The magnetic field B is shown
            only at one plane, $z=0$, but is equal to the electric field (in
            cgs units!) but along $y$.}
    \end{figure*}
    
    
    xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx xxx x x xx xxxx xx xxx xxxxx zx 
    
    \marginpar{xxx x x xx xxxx xx xxx xxxxx zx}
    
\end{document}

相关内容