我想在图像下方放置日历。
但很难用resizebox
: 来改变 x 或 y 位置
最小代码:
\documentclass[a5paper,oneside,10pt]{article}
\usepackage{translator, tikz, array}
\usetikzlibrary{calendar,shapes.geometric}
\usetikzlibrary{calc}
\begin{document}
\includegraphics[width=10cm]{example-image-a}
\\
\hspace{3.5cm}
\vspace{-2.0cm}
\resizebox{10cm}{!}{
\begin{tikzpicture}[every node/.append style = {anchor=center}]
\calendar (mycal) [dates=2019-9-1 to 2019-9-last, week list,
day text=\%d0,
month label above centered,
month text={\%mt} \%y-,
day xshift =1.0cm,
day yshift = 0.65cm
]
if (Saturday) [blue]
if (Sunday) [green]
;
\end{tikzpicture}
}
\end{document}
请帮忙在图像 A 下方放置一个日历,或者更好的解决方案,如何为其提供明确的绝对位置resizebox
?
答案1
您只需将图形添加到tikzpicture
(并确保其宽度不超过\linewidth
)。
\documentclass[a5paper,oneside,10pt]{article}
\usepackage{translator, tikz, array}
\usetikzlibrary{calendar,positioning}
\begin{document}
\begin{tikzpicture}[every node/.append style = {anchor=center}]
\begin{scope}[local bounding box=calendar]
\calendar (mycal) [dates=2019-9-1 to 2019-9-last, week list,
day text=\%d0,
month label above centered,
month text={\%mt} \%y-,
day xshift =1.0cm,
day yshift = 0.65cm
]
if (Saturday) [blue]
if (Sunday) [green]
;
\end{scope}
\node[above=0.2cm of calendar]{\includegraphics[width=0.9\linewidth]{example-image-a}};
\end{tikzpicture}
\end{document}
\documentclass[a5paper,oneside,10pt]{article}
\usepackage{translator, tikz, array}
\usetikzlibrary{calendar,positioning}
\begin{document}
\begin{tikzpicture}[every node/.append style = {anchor=center}]
\begin{scope}[local bounding box=calendar]
\calendar (mycal) [scale=0.7,dates=2019-9-1 to 2019-9-last, week list,
day text=\%d0,
month label above centered,
month text={\%mt} \%y-,
day xshift =1.0cm,
day yshift = 0.65cm
]
if (Saturday) [blue]
if (Sunday) [green]
;
\end{scope}
\node[above=2cm of calendar]{\includegraphics[width=0.9\linewidth]{example-image-a}};
\end{tikzpicture}
\end{document}