![怎样才能将缩放图像的中心放置在文档中的任何位置--(x,y)?](https://linux22.com/image/289011/%E6%80%8E%E6%A0%B7%E6%89%8D%E8%83%BD%E5%B0%86%E7%BC%A9%E6%94%BE%E5%9B%BE%E5%83%8F%E7%9A%84%E4%B8%AD%E5%BF%83%E6%94%BE%E7%BD%AE%E5%9C%A8%E6%96%87%E6%A1%A3%E4%B8%AD%E7%9A%84%E4%BB%BB%E4%BD%95%E4%BD%8D%E7%BD%AE--(x%EF%BC%8Cy)%EF%BC%9F.png)
根据某个坐标系,无论它是什么,如何使用图像中心作为参考点将缩放后的图像定位到文档中我想要的位置?例如,像这样:
\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}