如何在页面左下角插入图像

如何在页面左下角插入图像

我有一个文档,我想在页面的右下角插入一张图片。我想创建一个 minpage 环境来做到这一点。但我找不到在我想要的位置插入这张图片的方法。我该怎么做?

\documentclass[14pt]{extarticle}
\usepackage{fontspec}
\setmainfont{industry-blackitalic}
\usepackage{lipsum}
\usepackage{mwe}
\usepackage{textpos}
\usepackage{graphics}
\pagenumbering{gobble}

\begin{document}
    \lipsum [1-1]\\

\newpage %------ II pagina ------------

    \lipsum [1-1]\\

\newpage %-------- III pagina ------------

    \lipsum [1-1]\\

\newpage %--------IV pagina --------------

    \lipsum[1-1]
\end{document}

谢谢

雷纳托

答案1

仍然不太清楚你想要什么。不过,这里有一个示例,说明如何使用textpos它将图像打印在一页的四个角上(示例中为第一个):

\documentclass[14pt]{extarticle}
\usepackage{fontspec}
%\setmainfont{industry-blackitalic}% Removed, because not essential for the problem.
%\usepackage{lipsum}% Removed, because also loaded by mwe
\usepackage{mwe}
\usepackage[absolute]{textpos}
\usepackage{graphics}
\pagenumbering{gobble}

\begin{document}
\begin{textblock*}{\paperwidth}(0mm,0mm)% Upper
  \raggedright% left edge of page
  \includegraphics[page=1,width=4cm]{example-image-a4-numbered}
\end{textblock*}
\begin{textblock*}{\paperwidth}(0mm,0mm)% Upper
  \raggedleft% right edge of page
  \includegraphics[page=2,width=4cm]{example-image-a4-numbered}
\end{textblock*}
\begin{textblock*}{\paperwidth}(0mm,\paperheight)% Lower
  \raggedright% left edge of page
  \raisebox{0pt}[0pt][0pt]{\includegraphics[page=3,width=4cm]{example-image-a4-numbered}}
\end{textblock*}
\begin{textblock*}{\paperwidth}(0mm,\paperheight)% Lower
  \raggedleft% right edge of page
  \raisebox{0pt}[0pt][0pt]{\includegraphics[page=4,width=4cm]{example-image-a4-numbered}}
\end{textblock*}

    \lipsum [1-1]%\\% You should never use \\ at the end of a paragraph!

\newpage %------ II pagina ------------

    \lipsum [1-1]%\\% You should never use \\ at the end of a paragraph!

\newpage %-------- III pagina ------------

    \lipsum [1-1]%\\% You should never use \\ at the end of a paragraph!

\newpage %--------IV pagina --------------

    \lipsum[1-1]

\end{document}

纸张角落处的四幅图像

如果您希望图像位于文本区域的角落,只需删除选项absolute并替换\paperwidth为。\textwidth\paperheight\textheight

如果您想要每一页上的图像,使用eso-pic会更简单:

\documentclass[14pt]{extarticle}
\usepackage{fontspec}
%\setmainfont{industry-blackitalic}% Removed, because not essential for the problem.
%\usepackage{lipsum}% Removed, because also loaded by mwe
\usepackage{mwe}
\usepackage{eso-pic}
\usepackage{adjustbox}
\usepackage{graphics}
\pagenumbering{gobble}

\AddToShipoutPictureBG{% put the images in the background of every page
  \AtPageUpperLeft{% upper left corner of the page
    \adjincludegraphics[page=1,width=4cm,valign=T]{example-image-a4-numbered}%
  }%
  \AtPageUpperLeft{% upper
    \makebox[\paperwidth][r]{% right corner of the page
      \adjincludegraphics[page=2,width=4cm,valign=T]{example-image-a4-numbered}%
    }%
  }%
  \AtPageLowerLeft{% lower left corner of the page
    \includegraphics[page=3,width=4cm]{example-image-a4-numbered}%
  }%
  \AtPageLowerLeft{% lower
    \makebox[\paperwidth][r]{% right corner of the page
      \includegraphics[page=3,width=4cm]{example-image-a4-numbered}%
    }%
  }%
}
\begin{document}

    \lipsum [1-1]%\\% You should never use \\ at the end of a paragraph!

\newpage %------ II pagina ------------

    \lipsum [1-1]%\\% You should never use \\ at the end of a paragraph!

\newpage %-------- III pagina ------------

    \lipsum [1-1]%\\% You should never use \\ at the end of a paragraph!

\newpage %--------IV pagina --------------

    \lipsum[1-1]
\end{document}

使用 eso-pic 或 hooks 在页面的每个角落添加图片

再次,您可以调整这些示例,将图像放在文本区域的边缘而不是纸张上。为此,再次用 替换,\paperwidth\textwidth用 替换,\AtPageUpperLeft\AtTextUpperLeft\AtPageLowerLeft替换\AtTextLowerLeft

您还可以使用此建议,使用 star-variant 将图像仅添加到一页\AddToShipoutPictureBG*

使用最新的 LaTeX,您还可以使用发货钩

\documentclass[14pt]{extarticle}
\usepackage{fontspec}
%\setmainfont{industry-blackitalic}% Removed, because not essential for the problem.
%\usepackage{lipsum}% Removed, because also loaded by mwe
\usepackage{mwe}
\usepackage{adjustbox}
\usepackage{graphics}
\pagenumbering{gobble}

\AddToHook{shipout/background}{% Put the images in the background of every page
  \put(0,0){% upper left corner
    \adjincludegraphics[page=1,width=4cm,valign=T]{example-image-a4-numbered}%
  }%
  \put(0,0){% upper
    \makebox[\paperwidth][r]{% right corner
      \adjincludegraphics[page=2,width=4cm,valign=T]{example-image-a4-numbered}%
    }%
  }%
  \put(0,-\pageheight){% lower left corner
    \includegraphics[page=3,width=4cm]{example-image-a4-numbered}%
  }%
  \put(0,-\pageheight){% lower
    \makebox[\paperwidth][r]{% right corner
      \includegraphics[page=4,width=4cm]{example-image-a4-numbered}%
    }%
  }%
}
\begin{document}

    \lipsum [1-1]%\\% You should never use \\ at the end of a paragraph!

\newpage %------ II pagina ------------

    \lipsum [1-1]%\\% You should never use \\ at the end of a paragraph!

\newpage %-------- III pagina ------------

    \lipsum [1-1]%\\% You should never use \\ at the end of a paragraph!

\newpage %--------IV pagina --------------

    \lipsum[1-1]
\end{document}

有关它们的更多信息,请参阅所用软件包的手册。请参阅通用钩子手册有关使用钩子的信息。


注意:还有许多其他方法可以将图像或其他材料放置在文档的单个或所有页面上的固定位置。此处显示的方法可能是最简单也是最常用的。另一种可能性,非常受欢迎蒂克兹用户,显示在这个答案已经作为评论链接的问题scrlayer-scrpage。作为非常规解决方案的一个示例,这里显示了包的使用:

\documentclass[14pt]{extarticle}
\usepackage{fontspec}
%\setmainfont{industry-blackitalic}% Removed, because not essential for the problem.
%\usepackage{lipsum}% Removed, because also loaded by mwe
\usepackage{mwe}
\usepackage{adjustbox}
\usepackage{graphics}
\pagenumbering{gobble}
\usepackage{scrlayer-scrpage}
\pagestyle{plain}

\DeclareNewLayer[%
  background,%
  mode=picture,%
  page,
  contents={%
    \put(0,\paperheight){%
      \adjincludegraphics[page=1,width=4cm,valign=T]{example-image-a4-numbered}%
    }%
    \put(\paperwidth,\paperheight){%
      \makebox[0pt][r]{%
        \adjincludegraphics[page=2,width=4cm,valign=T]{example-image-a4-numbered}%
      }%
    }%
    \put(0,0){%
      \includegraphics[page=3,width=4cm]{example-image-a4-numbered}%
    }%
    \put(\paperwidth,0){%
      \makebox[0pt][r]{%
        \includegraphics[page=4,width=4cm]{example-image-a4-numbered}%
      }%
    }%
  }%
]
{cornerimages}
\AddLayersToPageStyle{plain.scrheadings}{cornerimages}

\begin{document}

    \lipsum [1-1]%\\% You should never use \\ at the end of a paragraph!

\newpage %------ II pagina ------------

    \lipsum [1-1]%\\% You should never use \\ at the end of a paragraph!

\newpage %-------- III pagina ------------

    \lipsum [1-1]%\\% You should never use \\ at the end of a paragraph!

\newpage %--------IV pagina --------------

    \lipsum[1-1]
\end{document}

此建议的一个优点是,您可以在每个页面的每种页面样式中添加和删除新声明的图层。您甚至可以声明带有或不带有此图层的新页面样式。因此,对于\pagenumbering{gobble}仅包含图像的页面,无需执行以下操作:

\documentclass[14pt]{extarticle}
\usepackage{fontspec}
%\setmainfont{industry-blackitalic}% Removed, because not essential for the problem.
%\usepackage{lipsum}% Removed, because also loaded by mwe
\usepackage{mwe}
\usepackage{adjustbox}
\usepackage{graphics}
\usepackage{scrlayer-scrpage}

\DeclareNewLayer[%
  background,%
  mode=picture,%
  page,
  contents={%
    \put(0,\paperheight){%
      \adjincludegraphics[page=1,width=4cm,valign=T]{example-image-a4-numbered}%
    }%
    \put(\paperwidth,\paperheight){%
      \makebox[0pt][r]{%
        \adjincludegraphics[page=2,width=4cm,valign=T]{example-image-a4-numbered}%
      }%
    }%
    \put(0,0){%
      \includegraphics[page=3,width=4cm]{example-image-a4-numbered}%
    }%
    \put(\paperwidth,0){%
      \makebox[0pt][r]{%
        \includegraphics[page=4,width=4cm]{example-image-a4-numbered}%
      }%
    }%
  }%
]
{cornerimages}
\DeclareNewPageStyleByLayers{imagepagestyle}{cornerimages}
\pagestyle{imagepagestyle}

\begin{document}

\pagestyle{empty}

\lipsum[1-3]

\thispagestyle{imagepagestyle}% Use the images only on this page

\lipsum[4-10]

\pagestyle{imagepagestyle}% And from this page.

\lipsum

\end{document}

答案2

虽然你的问题很令人困惑(你应该至少展示一个你期望的输出示例和一个重现你的问题的最小代码示例),但我会尝试“猜测”你想要做什么:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\begin{document}

% Your document content here

\vfill % push the minipage to the bottom of the page
\noindent % prevent indentation
\begin{minipage}[b]{\linewidth}
    \raggedleft % right-align the content of the minipage
    \includegraphics[width=0.3\linewidth]{example-image} % replace 'example-image' with your image file name
\end{minipage}

\end{document}

在此处输入图片描述

相关内容