Skip to content

Instantly share code, notes, and snippets.

@jnothman
Last active November 17, 2021 05:08
Show Gist options
  • Save jnothman/0729018fc39b2c30f082 to your computer and use it in GitHub Desktop.
Save jnothman/0729018fc39b2c30f082 to your computer and use it in GitHub Desktop.
"Fork me on GitHub" ribbon in LaTeX/TikZ vector graphic
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
\documentclass{article}
\usepackage{tikz}
\usepackage{ifthen}
\usepackage{xcolor}
\usetikzlibrary{shadows.blur}
\newlength{\forkmeoffset}
\setlength{\forkmeoffset}{12em}
\definecolor{forkmebg}{HTML}{CC0000}
\definecolor{forkmefg}{HTML}{EEEEEE}
\newcommand{\forkme}[1][west]{
\ifthenelse{\equal{#1}{east}}{%
\tikzset{forkmerot/.style={rotate=-45}}
}{%
\tikzset{forkmerot/.style={rotate=45}}
}
\begin{tikzpicture}[remember picture, overlay]
\node[forkmerot, shift={(0, -\forkmeoffset)}] at (current page.north #1) {
\begin{tikzpicture}[remember picture, overlay]
\node[fill=forkmebg, text centered, minimum width=50em, minimum height=3.0em, blur shadow, shadow yshift=0pt, shadow xshift=0pt, shadow blur radius=.4em, shadow opacity=50, text=forkmefg](fmogh) at (0pt, 0pt) { \fontfamily{phv}\selectfont\bfseries Fork me on GitHub};
\draw[forkmefg!60, dashed, line width=.08em, dash pattern=on .5em off 1.5\pgflinewidth] (-25em,1.2em) rectangle (25em,-1.2em);
\end{tikzpicture}
};
\end{tikzpicture}
}
\begin{document}
\forkme[west]
{\LARGE\colorlet{forkmebg}{blue} \setlength{\forkmeoffset}{8cm} \forkme[east]}
Variables include:
\begin{itemize}
\item \texttt{{\textbackslash}forkme[west]} vs \texttt{{\textbackslash}forkme[east]}
\item shift offset (length: \texttt{{\textbackslash}forkmeoffset})
\item node fill color (color: \texttt{forkmebg})
\item text and line color (color: \texttt{forkmefg})
\item text size: inherited from surrounding context
\end{itemize}
\end{document}
@faustomilletari
Copy link

It is possible to add the link changing
\node[fill=forkmebg, text centered, minimum width=50em, minimum height=3.0em, blur shadow, shadow yshift=0pt, shadow xshift=0pt, shadow blur radius=.4em, shadow opacity=50, text=forkmefg](fmogh) at (0pt, 0pt) { \fontfamily{phv}\selectfont\bfseries Fork me on GitHub};

to

\node[fill=forkmebg, text centered, minimum width=50em, minimum height=3.0em, blur shadow, shadow yshift=0pt, shadow xshift=0pt, shadow blur radius=.4em, shadow opacity=50, text=forkmefg](fmogh) at (0pt, 0pt) { \fontfamily{phv}\selectfont\bfseries \href{https://url.com}{Fork me on GitHub} };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment