合并两个 MWE(tikz、mdframed)时出现问题//插入淡入淡出的线条

合并两个 MWE(tikz、mdframed)时出现问题//插入淡入淡出的线条

如何整合微波能量吸收 1

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[remember picture,overlay]
\path[left color=orange,right color=white]
([yshift=-62pt]current page.north west)
+(0,-2pt) rectangle +(14cm,2pt); 

\path[left color=orange,right color=white]
([yshift=-175pt,xshift=+14cm]current page.north west)
+(0,-.5pt) rectangle +(5.1cm,0.5pt);
\end{tikzpicture}
\end{document}

进入微波辐射计 2

在此处输入图片描述

\documentclass{minimal}

\usepackage{xcolor}
\usepackage[framemethod=tikz]{mdframed}

\usepackage{anyfontsize,multirow,mwe}

\newenvironment{infobox}[2][green]{%
  \begin{mdframed}[%
    skipabove=4ex plus .5ex minus .5ex,%
    skipbelow=4ex plus .5ex minus .5ex,%
    frametitle={\sffamily #2},%
    innertopmargin=2ex,%
    innerbottommargin=2ex,%
    frametitleaboveskip=1.618ex,%
    frametitlebelowskip=1.618ex,%
    frametitlebackgroundcolor=#1,%
    linecolor=#1]%
}{%
  \end{mdframed}%
}

\begin{document}
\begin{center}
  \fontsize{50}{60}\selectfont
  \sffamily
  \scshape
  \color{green!50!black}
Hello World!
\end{center}
\begin{infobox}[green!80!black]{\textcolor{white}{Some Random Title}}
  \renewcommand{\tabcolsep}{1cm}
  \begin{tabular}{lll}
    \multirow{7}{*}{\includegraphics[width=3cm]{example-image-a}} & Date & 22 February 2002 \\
    & a & b \\
    & a & b \\
    &   &   \\
    & a & b \\
    & a & b \\
    & a & b \\
  \end{tabular}
\end{infobox}

\begin{infobox}[green!80!black]{Another Title}
  \begin{list}{...}{...}
    \item[...] ...
  \end{list}
\end{infobox}
\end{document}


最终,我想在 MWE 2 的某处画一条褪色的线(如 MWE 1 中所示)。MWE 1 只是一个例子。

因此期望的输出应该是这样的:

在此处输入图片描述

以下是“合并”代码的尝试:

\documentclass{minimal}

\usepackage{xcolor}
\usepackage[framemethod=tikz]{mdframed}

\usepackage{anyfontsize,multirow,mwe}

\newenvironment{infobox}[2][green]{%
  \begin{mdframed}[%
    skipabove=4ex plus .5ex minus .5ex,%
    skipbelow=4ex plus .5ex minus .5ex,%
    frametitle={\sffamily #2},%
    innertopmargin=2ex,%
    innerbottommargin=2ex,%
    frametitleaboveskip=1.618ex,%
    frametitlebelowskip=1.618ex,%
    frametitlebackgroundcolor=#1,%
    linecolor=#1]%
}{%
  \end{mdframed}%
}

\begin{document}
\begin{center}
  \fontsize{50}{60}\selectfont
  \sffamily
  \scshape
  \color{green!50!black}
  Hello World!
\end{center}
\begin{infobox}[green!80!black]{\textcolor{white}{Some Random Title}}
  \renewcommand{\tabcolsep}{1cm}
  \begin{tabular}{lll}
    \multirow{7}{*}{\includegraphics[width=3cm]{example-image-a}} & Date & 22 February 2002 \\
    & a & b \\
    & a & b \\
    &   &   \\
    %%%%%%%%%% (unsuccessful attempt to incorporate "MWE 1" %%%%%%%%%%%%%%%%%%
  \begin{tikzpicture}[remember picture,overlay]
\path[left color=orange,right color=white]
([yshift=-62pt]current page.north west)
+(0,-2pt) rectangle +(14cm,2pt); 

\path[left color=orange,right color=white]
([yshift=-175pt,xshift=+14cm]current page.north west)
+(0,-.5pt) rectangle +(5.1cm,0.5pt);
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    & a & b \\
    & a & b \\
    & a & b \\
  \end{tabular}
\end{infobox}

\begin{infobox}[green!80!black]{Another Title}
  \begin{list}{...}{...}
    \item[...] ...
  \end{list}
%%%%%%%%%% (unsuccessful attempt to incorporate "MWE 1" %%%%%%%%%%%%%%%%%%
  \begin{tikzpicture}[remember picture,overlay]
\path[left color=orange,right color=white]
([yshift=-62pt]current page.north west)
+(0,-2pt) rectangle +(14cm,2pt); 

\path[left color=orange,right color=white]
([yshift=-175pt,xshift=+14cm]current page.north west)
+(0,-.5pt) rectangle +(5.1cm,0.5pt);
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{infobox}


\end{document}

答案1

似乎你不想要页面覆盖,可以直接绘制矩形

在此处输入图片描述

\documentclass{minimal}

\usepackage{xcolor}
\usepackage[framemethod=tikz]{mdframed}

\usepackage{anyfontsize,multirow,mwe}

\newenvironment{infobox}[2][green]{%
  \begin{mdframed}[%
    skipabove=4ex plus .5ex minus .5ex,%
    skipbelow=4ex plus .5ex minus .5ex,%
    frametitle={\sffamily #2},%
    innertopmargin=2ex,%
    innerbottommargin=2ex,%
    frametitleaboveskip=1.618ex,%
    frametitlebelowskip=1.618ex,%
    frametitlebackgroundcolor=#1,%
    linecolor=#1]%
}{%
  \end{mdframed}%
}

\begin{document}
\begin{center}
  \fontsize{50}{60}\selectfont
  \sffamily
  \scshape
  \color{green!50!black}
  Hello World!
\end{center}
\begin{infobox}[green!80!black]{\textcolor{white}{Some Random Title}}
  \renewcommand{\tabcolsep}{1cm}
  \begin{tabular}{lll}
    \multirow{7}{*}{\includegraphics[width=3cm]{example-image-a}} & Date & 22 February 2002 \\
    & a & b \\
    & a & b \\
    &   &   \\
    %%%%%%%%%% (unsuccessful attempt to incorporate "MWE 1" %%%%%%%%%%%%%%%%%%
  \begin{tikzpicture}[remember picture,overlay]
\path[left color=orange,right color=white]
([yshift=-62pt]current page.north west)
+(0,-2pt) rectangle +(14cm,2pt); 

\path[left color=orange,right color=white]
([yshift=-175pt,xshift=+14cm]current page.north west)
+(0,-.5pt) rectangle +(5.1cm,0.5pt);
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    & a & b \\
    & a & b \\
    & a & b \\
  \end{tabular}
\end{infobox}

\begin{infobox}[green!80!black]{Another Title}
  \begin{list}{...}{...}
    \item[...] ...
  \end{list}
%%%%%%%%%% (unsuccessful attempt to incorporate "MWE 1" %%%%%%%%%%%%%%%%%%

\begin{tikzpicture}
\path[left color=orange,right color=white]
rectangle +(14cm,2pt); 
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{infobox}


\end{document}

相关内容