![使用 Tikz 在图形下方插入文本](https://linux22.com/image/294222/%E4%BD%BF%E7%94%A8%20Tikz%20%E5%9C%A8%E5%9B%BE%E5%BD%A2%E4%B8%8B%E6%96%B9%E6%8F%92%E5%85%A5%E6%96%87%E6%9C%AC.png)
我正在制作一份新闻稿,但我一点也不熟练,尤其是对“tikz”等新的 Latex 功能。我想要一张大图片放在第一页(封面),在页面底部和中间写几行,以便可以指定版权和年份等。
我正在使用以下代码:
\documentclass{article}
\usepackage[lmargin=1cm, bmargin=0.2cm, tmargin=1cm, rmargin=1cm, centering, includefoot,heightrounded]{geometry}
\usepackage{tikz} %pagenodes}
\usetikzlibrary{calc}
\usepackage{lmodern}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{atbegshi}
\usepackage{mwe}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{here}
\usepackage{color}
\usepackage{framed}
\usepackage{wrapfig}
\usepackage[none]{hyphenat}
\usepackage{textcomp}
\definecolor{boxgray}{RGB}{139,137,137}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[remember picture, overlay]
\node[anchor = north west, inner sep=0] (image) at (current page.north west)
{\includegraphics[width=\paperwidth,height=0.9\paperheight]{whatever.eps}};
\node[align = center, anchor = below] at (current page.south) {\textcopyright\, 2014 ... individual authors. All rights reserved.\\ Other bla bla words};
\end{tikzpicture}
我认为这很容易,但我无法获得良好的布局,除非我以非常人为的方式指定事物并通过数字定位。我不太了解“节点”是如何工作的。我也阅读了很多关于这个 SE 的文章,尤其是这,但似乎我仍然无法遵循所有可用的选项。如果能提供一个清晰的例子就更好了。
另外,我从这里阅读关于空白边距的一些一般规则:如果有人知道任何有用的建议,那就太好了,因为指南说最好避免四周的边距相等,但它没有给出任何示例数字。
答案1
矩形节点没有下面调用的锚点。要么将其anchor=south
用于文本节点
\node[align = center, anchor=south] at (current page.south) {\textcopyright\, 2014 ... individual authors. All rights reserved.\\ Other bla bla words};
或使用
\node[align = center, above] at (current page.south) {\textcopyright\, 2014 ... individual authors. All rights reserved.\\ Other bla bla words};
该选项above
将节点锚点更改为south
。在这两种情况下,south
文本节点的锚点都将插入到(current page.south)
。
代码:
\documentclass{article}
\usepackage[lmargin=1cm, bmargin=0.2cm, tmargin=1cm, rmargin=1cm, centering, includefoot,heightrounded]{geometry}
\usepackage{tikz}% loads also graphicx and xcolor
\usepackage{lmodern}
\usepackage{mwe}% example-image
\definecolor{boxgray}{RGB}{139,137,137}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[remember picture, overlay]
\node[anchor = north west, inner sep=0] (image) at (current page.north west)
{\includegraphics[width=\paperwidth,height=0.9\paperheight]{example-image}};
\node[align = center, above] at (current page.south) {\textcopyright\, 2014 ... individual authors. All rights reserved.\\ Other bla bla words};
\end{tikzpicture}
\end{document}
答案2
您可以below = of image
从positioning
库中使用:
\documentclass{article}
\usepackage[lmargin=1cm, bmargin=0.2cm, tmargin=1cm, rmargin=1cm, centering, includefoot,heightrounded]{geometry}
\usepackage{tikz} %pagenodes}
\usetikzlibrary{calc,positioning} % <----
\usepackage{lmodern}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{atbegshi}
\usepackage{mwe}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{here}
\usepackage{color}
\usepackage{framed}
\usepackage{wrapfig}
\usepackage[none]{hyphenat}
\usepackage{textcomp}
\definecolor{boxgray}{RGB}{139,137,137}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[remember picture, overlay]
\node[anchor = north west, inner sep=0] (image) at (current page.north west)
{\includegraphics[width=\paperwidth,height=0.9\paperheight]{frog.jpg}};
\node[align = center, below = of image] % <----
{\textcopyright\, 2014 ... individual authors. All rights reserved.\\ Other bla bla words};
\end{tikzpicture}
\end{document}