\documentclass{article} \usepackage{fontspec} \setmainfont{Noto Serif} \usepackage{etoolbox} % \ifblank \usepackage{xparse} % Optional * and optional {} argument \usepackage{calc} % \heightof \usepackage{graphicx} % \reflectbox \usepackage[svgnames]{xcolor} % colors! \usepackage{booktabs} \usepackage{longtable} \usepackage{hyperref} \title{Reversed pilcrow in black/colored box} \author{Benct Philip Jonsson} \date{2019-12-05} % Typeset a reverse pilcrow in a colored and/or framed box % % `\Pandoc` % : White reverse pilcrow in black box. % `\Pandoc*` % : Black reverse pilcrow in white box with black frame. % `\Pandoc{blue}` % : White reverse pilcrow in blue box. % `\Pandoc*{blue}` % : Blue reverse pilcrow in white box with blue frame. % `\Pandoc[yellow]{blue}` % : Yellow reverse pilcrow in blue box. % `\Pandoc*[yellow]{blue}` % : Blue reverse pilcrow in yellow box with blue frame. % % In spite of the braces the second color is also optional! % % | | Argument | Meaning | Unframed (default) | Framed (default) % |----|----------|-----------|--------------------|------------------- % | #1 | * (star) | Framed? | no star | star % | #2 | [color] | Secondary | Foreground (white) | Background (page) % | #3 | {color} | Primary | Background (black) | Foreground (black) % % If \Pandoc (no star!) % : [#2] is foreground (text), % : {#3} is background (box) color. % If \Pandoc* (with star), i.e. with frame % : [#2] is background (box), % : {#3} is foreground (text, frame) color. % % This command requires the packages % *graphicx*, *xcolor*, *xparse*, and *etoolbox* % Helper commands to type less \NewDocumentCommand{\pickMyColor}{ r() m r() m r() m }{ \IfBooleanTF{#1}{% if framed \ifblank{#4}{\definecolor{#2}{named}{#3}}{\definecolor{#2}{named}{#4}}% }{% if not framed \ifblank{#6}{\definecolor{#2}{named}{#5}}{\definecolor{#2}{named}{#6}}% }% } \newcommand{\maybeFramebox}[3]{\IfBooleanTF{#1}{\fcolorbox{#3}{#2}}{\colorbox{#2}}} \NewDocumentCommand{\Pandoc}{ s !O{} !G{} }{ \pickMyColor(#1){PandocLogoForeground}(black){#3}(white){#2}% \pickMyColor(#1){PandocLogoBackground}(white){#2}(black){#3}% \reflectbox{% Reverse the pilcrow \maybeFramebox{#1}{PandocLogoBackground}{PandocLogoForeground}{% \color{PandocLogoForeground}% \makebox[\heightof{\P}][c]{\P}% }% }% } % Typeset a colored square with a reverse pilcrow in % the complementary color of the box color: % % `\PandocBox` % : A black box with a white reverse pilcrow. % `\PandocBox[blue] % : A blue box with a "-blue" reverse pilcrow. % % This command requires the packages *graphicx* and *xcolor* \newcommand{\PandocBox}[1][black]{ \reflectbox{\colorbox{#1}{\makebox[\heightof{\P}][c]{\color{-#1}\P}}}} % Typeset a colored reverse pilcrow in a box of the same color % % `\PandocFrame` % : A black frame with a black reverse pilcrow. % `\PandocFrame[blue] % : A blue frame with a blue reverse pilcrow. % % This command requires the packages *graphicx* and *xcolor* \newcommand{\PandocFrame}[1][black]{ \reflectbox{\color{#1}\fbox{\makebox[\heightof{\P}][c]{\P}}}} % Helper command for examples \newcommand{\textLarge}[1]{{\Large #1}} \begin{document} \maketitle \hypertarget{latex}{% \section*{LaTeX}\label{latex}} In LaTeX you can, through the \emph{graphicx} package, produce a reversed pilcrow with \texttt{\textbackslash{}reflectbox\{\textbackslash{}P\}}, thus reversing the ordinary pilcrow of whatever font you are using. The following isn't \emph{dead} simple, but satisfactory for a quite sophisticated design: \begin{verbatim} --- mainfont: Noto Serif header-includes: - | ````{=latex} \usepackage{graphicx} ```` --- \fbox{\Huge\makebox[1em][c]{\reflectbox{\P}}} \colorbox{black}{\Huge\makebox[1em][c]{\reflectbox{\textcolor{white}{\P}}}} \fbox{\textcolor{red}{\fbox{\Huge\makebox[1em][c]{\reflectbox{\P}}}} Made with Pandoc} \end{verbatim} Attached are three commands for typesetting a reverse pilcrow in a colored and/or framed box, black/white by default but allowing custom colors. Note that the colors below are only examples. \hypertarget{typeset-a-reverse-pilcrow-in-a-colored-andor-framed-box}{% \subsection*{Typeset a reverse pilcrow in a colored and/or framed box}\label{typeset-a-reverse-pilcrow-in-a-colored-andor-framed-box}} \begin{description} \item[\texttt{\textbackslash{}Pandoc}] White reverse pilcrow in black box. \textLarge{\Pandoc} \item[\texttt{\textbackslash{}Pandoc*}] Black reverse pilcrow in white box with black frame. \textLarge{\Pandoc*} \item[\texttt{\textbackslash{}Pandoc\{DarkGreen\}}] White reverse pilcrow in DarkGreen box. \textLarge{\Pandoc{DarkGreen}} \item[\texttt{\textbackslash{}Pandoc*\{DarkGreen\}}] DarkGreen reverse pilcrow in white box with DarkGreen frame. \textLarge{\Pandoc*{DarkGreen}} \item[\texttt{\textbackslash{}Pandoc{[}Gold{]}\{DarkGreen\}}] Gold reverse pilcrow in DarkGreen box. \textLarge{\Pandoc[Gold]{DarkGreen}} \item[\texttt{\textbackslash{}Pandoc*{[}Gold{]}\{DarkGreen\}}] DarkGreen reverse pilcrow in Gold box with DarkGreen frame. \textLarge{\Pandoc*[Gold]{DarkGreen}} \end{description} In spite of the braces the second color is also optional! \begin{longtable}[]{@{}lllll@{}} \toprule & Argument & Meaning & Unframed (default) & Framed (default)\tabularnewline \midrule \endhead \#1 & \texttt{*} (star) & Framed? & no star & star\tabularnewline \#2 & \texttt{{[}color{]}} & Secondary & Foreground (white) & Background (page)\tabularnewline \#3 & \texttt{\{color\}} & Primary & Background (black) & Foreground (black)\tabularnewline \bottomrule \end{longtable} \begin{description} \item[If \texttt{\textbackslash{}Pandoc} (no star!)] \texttt{{[}\#2{]}} is foreground (text), \texttt{\{\#3\}} is background (box) color. \item[If \texttt{\textbackslash{}Pandoc*} (with star), i.e.~with frame] \texttt{{[}\#2{]}} is background (box), \texttt{\{\#3\}} is foreground (text, frame) color. \end{description} This command requires the packages \emph{graphicx}, \emph{xcolor}, \emph{xparse}, and \emph{etoolbox} \hypertarget{typeset-a-colored-square-with-a-reverse-pilcrow-in-the-complementary-color}{% \subsection*{Typeset a colored square with a reverse pilcrow in the complementary color}\label{typeset-a-colored-square-with-a-reverse-pilcrow-in-the-complementary-color}} \begin{description} \item[\texttt{\textbackslash{}PandocBox}] A black box with a white reverse pilcrow. \textLarge{\PandocBox} \item[\texttt{\textbackslash{}PandocBox{[}Crimson{]}}] A Crimson box with a ``-Crimson'' reverse pilcrow. \textLarge{\PandocBox[Crimson]} \end{description} This command requires the packages \emph{graphicx} and \emph{xcolor} \hypertarget{typeset-a-colored-reverse-pilcrow-in-a-box-of-the-same-color}{% \subsection*{Typeset a colored reverse pilcrow in a box of the same color}\label{typeset-a-colored-reverse-pilcrow-in-a-box-of-the-same-color}} \begin{description} \item[\texttt{\textbackslash{}PandocFrame}] A black frame with a black reverse pilcrow. \textLarge{\PandocFrame} \item[\texttt{\textbackslash{}PandocFrame{[}DarkGreen{]}}] A DarkGreen frame with a DarkGreen reverse pilcrow. \textLarge{\PandocFrame[DarkGreen]} \end{description} This command requires the packages \emph{graphicx} and \emph{xcolor} \end{document}