將徽標放置在文件的右下角

將徽標放置在文件的右下角

我製作了一個帶有首頁的 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上方和旁邊添加了一個間隙。\columnsep我還在\dp\strutbox兩個流程框架之間添加了間隙來嘗試模擬\baselineskip

在這種情況下,第一個分隔符號發生在兩個段落之間,但您仍然需要添加 a\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}

相關內容