请检查以下 MWE:
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{mwe}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usepackage[framemethod=tikz]{mdframed}
\mdfdefinestyle{mystyle1}{
apptotikzsetting={\tikzset{mdfbackground/.style={},}},
extra={
\scoped[on background layer]{
\node
[xshift=.5*\mdfboundingboxwidth, yshift=.5*\mdfboundingboxheight, opacity=.4]
{\includegraphics
[width=\mdfboundingboxwidth, height=\mdfboundingboxheight]
{example-image}
};
}
}
}
\mdfdefinestyle{mystyle2}{
apptotikzsetting={\tikzset{mdfbackground/.style={},}},
extra={
\scoped[on background layer]{
\node
[xshift=.5*\mdfboundingboxwidth, yshift=.5*\mdfboundingboxheight, opacity=.4]
{\includegraphics
[width=\mdfboundingboxwidth, height=\mdfboundingboxheight, keepaspectratio]
{example-image}
};
}
}
}
\mdfdefinestyle{mystyle3}{
apptotikzsetting={\tikzset{mdfbackground/.style={},}},
extra={
\scoped[on background layer]{
\node
[xshift=.5*\mdfboundingboxwidth, yshift=.5*\mdfboundingboxheight, opacity=.4]
{\includegraphics
[width=\mdfboundingboxwidth, height=\mdfboundingboxheight, keepaspectratio=true]
{example-image}
};
}
}
}
\mdfdefinestyle{mystyle4}{
apptotikzsetting={\tikzset{mdfbackground/.style={},}},
extra={
\scoped[on background layer]{
\node
[xshift=.5*\mdfboundingboxwidth, yshift=.5*\mdfboundingboxheight, opacity=.4]
{\includegraphics
[width=\mdfboundingboxwidth, height=\mdfboundingboxheight, keepaspectratio=false]
{example-image}
};
}
}
}
\begin{document}
\begin{mdframed}[style=mystyle1]
mystyle1
\blindtext
\end{mdframed}
\begin{mdframed}[style=mystyle2]
mystyle2
\blindtext
\end{mdframed}
\begin{mdframed}[style=mystyle3]
mystyle3
\blindtext
\end{mdframed}
\begin{mdframed}[style=mystyle4]
mystyle4
\blindtext
\end{mdframed}
\end{document}
mystyle1
和的间距问题mystyle4
出在哪里(框架与主体错位)?这可能是一个错误吗?
问候,伊凡