Add "Confidential" mark to a LaTeX footer
2019-04-07
160 words
1 min read
Table of Contents
Let' add “Confidential” mark to a LaTeX footer.
Define ConfidentialLevel
variable
First, we define tha variable ConfidentialLevel
to
show this
Code Snippet 1: Define ConfidentialLevel
(latex)
\global\let\@ConfidentialLevel\@empty
\def\ConfidentialLevel#1{\gdef\@ConfidentialLevel{#1}}
Define this variable in a LaTeX document preamble like this:
(latex)
\ConfidentialLevel{Confidential}
In a Org-mode document, define like this:
(org)
#+LATEX_HEADER: \ConfidentialLevel{Confidential}
Chagen it to anything you like. If not defined, it will not be displayed.
Change a LaTeX footer
Next, to change a LaTeX fotter,
we use fancyhdr
package and tcolorbox package:
Code Snippet 2: Change a LaTeX header and footer
(latex)
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins,raster,listings}
\tcbuselibrary{external}
\setlength{\footskip}{10truemm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\lhead{\rightmark}{}
\rhead{}{\leftmark}
\rfoot{
\ifx\@ConfidentialLevel\@empty
\else
\tcbox[colback=white,colframe=red,size=small,on line]{
\textcolor{red}{\sffamily \bfseries {\@ConfidentialLevel}}
}\fi%
}
\cfoot{\thepage}% print the page number in tha center of the footer
In a LaTeX documet, this will be typeset:
- the centre of a footer
- a page numer
- the right side of a footer
- “Confidential” mark
Related Articles:
- 2019/04/05 Change LaTeX emph with line marker style