0

How to integrate MWE 1

enter image description here

\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}

into MWE 2

enter image description here

\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}

?


Ultimately, I would like to draw a faded line (as in MWE 1) somewhere in MWE 2. MWE 1 is just an example.

So desired output should look sth like this:

enter image description here

and here's an attempt at "merging" the codes:

\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}
  • Untested: Try to use some overlay and tcolorbox instead of mdframed – user31729 Jun 26 '17 at 15:24
  • Can you be more precise about what you want. Should the line be a fixed position relative to the frame, or do you just want a line inside the box "at the current position" – Andrew Swann Jun 26 '17 at 16:02
  • @AndrewSwann the latter. will post an image of the desired look in a bit. – nutty about natty Jun 26 '17 at 19:51
  • @AndrewSwann done. – nutty about natty Jun 26 '17 at 20:22
  • Don't use the minimal class, it is too minimal. – Ulrike Fischer Jun 26 '17 at 21:12
2

It seems that you do not want a page overlay and can just draw the rectangle directly

enter image description here

\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}
  • what's a "page overlay"? like a "layer" in photoshop/gimp? – nutty about natty Jun 26 '17 at 21:17
  • @nuttyaboutnatty see your mwe1 \begin{tikzpicture}[remember picture,overlay] that is specifying a picture at absolute page coordinates overprinting any normal content, it's not part of the normal text flow. That failed mostly as you were using minimal class (unrelated to mdframed) but since the mdframe is part of the text content and moves with the text I don't think you want an overlay here at all. – David Carlisle Jun 26 '17 at 21:23
  • true. that happens when quickly grabbing code without rtfm etc first ;) texample.net/tikz/examples/feature/remember-picture – nutty about natty Jun 26 '17 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.