Skip to content

Instantly share code, notes, and snippets.

@Irubataru
Last active August 29, 2015 14:21
Show Gist options
  • Save Irubataru/44ca0f69c26a7dff5a67 to your computer and use it in GitHub Desktop.
Save Irubataru/44ca0f69c26a7dff5a67 to your computer and use it in GitHub Desktop.
Tikz Dim Code
% Given the name of two tikz nodes, this dims the lines starting at node 1, ending at node 2
\newcommand{\dimtext}[2]%
{
{ \transparent{0.7}
\begin{tikzpicture}[overlay, remember picture]
\fill[white] ( #1 -| current page.north west) -- ++(0,1em) -- ++(\paperwidth,0) -- (#2 -| current page.north east)
-- ++(0,-.5em) -- ++(-\paperwidth,0) -- cycle;
\end{tikzpicture}
}
}[
\begin{document}
%The first function will be "dimmed", looking transparent
\begin{lstlisting}[escapeinside={(*}{*)}]
void foo(int x)(*\tikzmark{begin_dim}*)
{
// Do something
}(*\tikzmark{end_dim}*)
int main(int,char**)
{
std::cout << "Hello world!" << std::endl;
}
\end{lstlisting}
\dimtext{begin_dim}{end_dim}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment