怎样才能将缩放图像的中心放置在文档中的任何位置--(x,y)?

怎样才能将缩放图像的中心放置在文档中的任何位置--(x,y)?

根据某个坐标系,无论它是什么,如何使用图像中心作为参考点将缩放后的图像定位到文档中我想要的位置?例如,像这样:

\being{whatever}(4cm,6cm)
     \includegraphics[scale=0.5]{img.jpg}
\end{whatever}

以下是我的最低限度的工作内容:

\documentclass{article}
\usepackage{something}
\title{Cartesian closed categories and the price of eggs}
\author{Jane Doe}
\date{September 1994}
\begin{document}
   \maketitle
   Hello world!
\end{document}

答案1

只需将放置的文本替换为相应的文本即可\includegraphics

在此处输入图片描述

以下是改编版有哪些方法可以将内容绝对定位在页面上用来\includegraphics[<<options>>]{<<file>>}代替给定的文本。

代码:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}


%% ------ https://tex.stackexchange.com/a/169836/4301
%% Following obtained from \layout. May need adjustment based on class and
%% page settings.  Alternatively, can set these to 0pt and then position will
%% be relative to bottom left of page.
\newcommand*{\BottomLeftX}{1.0in+\hoffset+\oddsidemargin}%
\newcommand*{\BottomLeftY}{\paperheight-1.0in-\voffset-\topmargin-\headheight-\headsep-\textheight}%

\newcommand*{\AbsolutePosition}[4][]{%
    % #1 = tikz options
    % #2 = x (from south west corner of page
    % #3 = y
    % #4 = text
    \begin{tikzpicture}[remember picture,overlay, ultra thick]
        %\draw [shift={(#2,#3)},#1]  (current page.south west) circle (2pt) 
        \draw [#1]  ($(current page.south west) + (\BottomLeftX,\BottomLeftY) + (#2,#3)$) 
            %circle (2pt) %  adding `[opacity=0.2]` to the node below will let you see this reference point
                node[] {#4};
    \end{tikzpicture}%
}

\title{Cartesian closed categories and the price of eggs}
\author{Jane Doe}
\date{September 1994}
\begin{document}
   \maketitle
   Hello world!

\AbsolutePosition[fill=red,draw=red]{7.0cm}{12.0cm}{\includegraphics[scale=0.1]{../images/EiffelWide}}
\end{document}

相关内容