我想在图片旁边使用标题,所以我使用了该floatrow
包。但是,如下图所示,我无法根据奇数页或偶数页自动将标题文本的位置从左到右更改。
任何想法都将受到赞赏。
\documentclass[12pt]{book}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[paperheight=24.0cm, paperwidth=20cm, top=1.75cm,bottom=2.0cm,left=2.0cm,right=6.0cm, headsep=0.25cm]{geometry}
\usepackage{floatrow}
\floatsetup[widefigure]{margins=hangleft,capposition=beside,capbesideposition={top,left},floatwidth=\textwidth}
\begin{document}
\lipsum[6]
\begin{figure*}[htp]
\includegraphics[width=0.5\textwidth]{image_test.png}
\caption{This is the first caption text}
\end{figure*}
\lipsum[6] \lipsum[6] \lipsum[6] \lipsum[6]
\begin{figure*}[htp]
\includegraphics[width=0.5\textwidth]{image_test.png}
\caption{This is the second caption text}
\end{figure*}
\lipsum[6]
\end{document}
答案1
也许您可以使用类似的东西。我创建在调用之前altfig
调用宏的环境。每次发货时都会切换的值,因此会使用两个中的一个,逐页交替。\csname floatsetup\mypage\endcsname
figure*
\mypage
\floatsetup
\documentclass[12pt]{book}
\usepackage{lipsum}
\usepackage[demo]{graphicx}
\usepackage {atbegshi}
\usepackage[paperheight=24.0cm, paperwidth=20cm, top=1.75cm,bottom=2.0cm,left=2.0cm,right=6.0cm, headsep=0.25cm]{geometry}
\usepackage{floatrow}
\def\mypage{0}
\AtBeginShipout{\ifnum\mypage=0\relax\gdef\mypage{1}%
\else\gdef\mypage{0}\fi}
\expandafter\def\csname floatsetup0\endcsname{%
\floatsetup[widefigure]
{margins=hangright,capposition=beside,capbesideposition={top,right},
floatwidth=\textwidth}}
\expandafter\def\csname floatsetup1\endcsname{%
\floatsetup[widefigure]
{margins=hangleft,capposition=beside,capbesideposition={top,left},
floatwidth=\textwidth}}
\newenvironment{altfig}[1][htbp]{\csname floatsetup\mypage\endcsname%
\begin{figure*}[#1]}{\end{figure*}}
\begin{document}
\lipsum[6]
\begin{altfig}[htp]
\includegraphics[width=0.5\textwidth]{image_test.png}
\caption{This is the first caption text}
\end{altfig}
\lipsum[6] \lipsum[6] \lipsum[6] \lipsum[6]
\begin{altfig}[htp]
\includegraphics[width=0.5\textwidth]{image_test.png}
\caption{This is the second caption text}
\end{altfig}
\lipsum[6-8]
\begin{altfig}[htp]
\includegraphics[width=0.5\textwidth]{image_test.png}
\caption{This is the third caption text}
\end{altfig}
\end{document}