我制作了一个包含首页的 Latex 文档,首页左下角有一个徽标。但是现在需要将这个徽标放在右下角,并且放在每一页上,如果我将当前的徽标放在每一页的左下角,文本会与徽标重叠,因此当徽标位于右下角时,文本也需要浮动在徽标周围。
如果文档的边距发生变化,我仍然希望将徽标移动到右下角(如果可能的话)。
为了制作左下角的标志,我使用了这个eso-pic
包。
\AddToShipoutPictureFG*{\put(0,0){\includegraphics[width=40mm,scale=1]{images/logo.png}}}
\documentclass[a4paper, twoside, 12pt, hidelinks, final]{article}
\usepackage[top=1in, bottom=1in, left=0.75in, right=0.75in, headheight=35.4pt, footskip=35.4pt]{geometry}
\usepackage{eso-pic} % https://ctan.org/pkg/eso-pic?lang=en
\usepackage{graphicx} % https://ctan.org/pkg/graphicx?lang=en
\AddToShipoutPictureFG*{\put(0,0){\includegraphics[width=40mm,scale=1]{images/logo.png}}}
\begin{document}
\clearpage\mbox{}\clearpage
\end{document}
答案1
这显示了如何将图像移动到右下角。它会缩小图像以适合边距。
\documentclass[a4paper, twoside, 12pt, hidelinks, final]{article}
\usepackage[top=1in, bottom=1in, left=0.75in, right=0.75in, headheight=35.4pt, footskip=35.4pt]{geometry}
\usepackage{eso-pic} % https://ctan.org/pkg/eso-pic?lang=en
\usepackage{graphicx} % https://ctan.org/pkg/graphicx?lang=en
\newsavebox{\logo}
\savebox{\logo}{\includegraphics[width=0.75in]{example-image}}% do once, then copy
\AddToShipoutPictureFG*{\put(\LenToUnit{\dimexpr \paperwidth-0.75in},0){\usebox\logo}}
\begin{document}
\clearpage\mbox{}\clearpage
\end{document}
该解决方案将边距设置为与图像大小相匹配。
\documentclass[a4paper, twoside, 12pt, hidelinks, final]{article}
\usepackage{graphicx} % https://ctan.org/pkg/graphicx?lang=en
\newsavebox{\logo}
\savebox{\logo}{\includegraphics[scale=0.3]{example-image}}% do once, then copy
\usepackage[top=1in, bottom=1in, left=\wd\logo, right=\wd\logo, headheight=35.4pt, footskip=35.4pt]{geometry}
\usepackage{eso-pic} % https://ctan.org/pkg/eso-pic?lang=en
\AddToShipoutPictureFG*{\put(\LenToUnit{\dimexpr \paperwidth-\wd\logo},0){\usebox\logo}}
\begin{document}
\clearpage\mbox{}\clearpage
\end{document}
此解决方案使用 flowfram。我在徽标\intextsep
上方和旁边添加了一个间隙。我还在两个 flow 框架之间添加了一个间隙以尝试模拟。\columnsep
\dp\strutbox
\baselineskip
在这种情况下,第一个分隔符出现在两个段落之间,但您仍需要添加\framebreak
以防止下一个段落的格式为错误的宽度。要手动插入\framebreak
和\nopar
,请在没有 的情况下运行它,适当的位置应该很明显。
\documentclass[a4paper, twoside, 12pt, hidelinks, final]{article}
\usepackage[top=1in, bottom=1in, left=0.75in, right=0.75in, headheight=35.4pt, footskip=35.4pt]{geometry}
\usepackage{graphicx} % https://ctan.org/pkg/graphicx?lang=en
\usepackage{flowfram}
\usepackage{lipsum}% MWE only
%framebreak within a paragraph
\newcommand{\nopar}{\parfillskip=0pt\framebreak\parfillskip=0pt plus1fil\noindent}
\newsavebox{\logo}
\savebox{\logo}{\includegraphics[scale=0.5]{example-image}}% get width and height
\newstaticframe{\wd\logo}{\ht\logo}{\dimexpr \paperwidth-0.75in-\wd\logo}{-1in}
\setstaticcontents{1}{\usebox\logo}
\newflowframe{\textwidth}{\dimexpr \textheight+1in-\ht\logo-\intextsep}{0pt}{\dimexpr \ht\logo-1in+\intextsep}
\newflowframe{\dimexpr \textwidth+0.75in-\wd\logo-\columnsep}{\dimexpr \ht\logo-1in+\intextsep-\dp\strutbox}{0pt}{0pt}
\begin{document}
\lipsum[1-6]\framebreak
Sed commodo posuere pede. Mauris ut est. Ut quis purus. Sed ac odio. Sed vehicula
hendrerit sem. Duis non odio. Morbi ut dui. Sed accumsan risus eget odio. In hac habitasse
platea dictumst. Pellentesque non elit. Fusce sed justo eu urna porta tincidunt. Mauris felis odio,\nopar
sollicitudin sed, volutpat a, ornare ac, erat. Morbi quis dolor. Donec pellentesque, erat ac sagittis
semper, nunc dui lobortis purus, quis congue purus metus ultricies tellus. Proin et quam. Class
aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Praesent
sapien turpis, fermentum vel, eleifend faucibus, vehicula eu, lacus.
\lipsum[8-10]
\end{document}