Skip to content

Instantly share code, notes, and snippets.

@shayanlinux
Last active November 1, 2015 22:51
LaTex Code Snippet to print sheet numbers in the trim area using memoir package and other loaded packages accompanying this question on StackExchange: http://tex.stackexchange.com/questions/263067/memoir-sheetsequence-counter-does-not-increment
\documentclass[a4paper]{memoir}
\usepackage{etoolbox}
\usepackage{bidi}
\begin{document}
\def\do#1{\thesheetsequence\newpage}
\docsvlist{1,2,3,4,5,6,7,8,9}
\end{document}
\usepackage{ifxetex}
\usepackage{ifpdf}
\usepackage{graphicx} % standard LaTeX graphics tool when including figure files
\graphicspath{{./figures/}}
\DeclareGraphicsExtensions{.pdf,.jpeg,.png,.jpg,.eps}
\usepackage{array} % improves the standard LaTeX2e array and tabular environments to provide better appearance and additional user controls.
\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{sidecap} % for side captions (use \begin{SCfigure})
\usepackage{verbatimbox} % for \begin{verbbox} and \theverbbox
\ifxetex
\usepackage{fontspec} % Required for specifying custom fonts in XeTeX
\setmainfont{Gentium Book Basic}
\setsansfont[Scale=MatchLowercase]{Open Sans}
\setmonofont[Scale=MatchLowercase]{Inconsolata}
\else
\usepackage[T1]{fontenc} % support for accents
\usepackage[utf8]{inputenx} % support for accents
\usepackage{lmodern}
\fi
\usepackage{amssymb}
\usepackage{wasysym}
\usepackage[main=english,dutch]{babel} % English / Dutch language/hyphenation
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage{xspace} % used in \newcommands, takes care of automatically insertion of space
\usepackage{paralist} % for \begin{inparaenum}[(i)] \item \end{inparaenum}
\usepackage{enumitem} % for [noitemsep,topsep=0pt] to adjust spacing
\usepackage{color} % used in \newcommands, a colorful text is better ;-)
\usepackage[usenames,dvipsnames,table]{xcolor} % required for the linkbordercolor option of the hyperref package
\usepackage[normalem]{ulem} % for \revdel which is using \sout to strike out
\usepackage{soul} % for \hl{}
\usepackage{url} % for \url{}
\usepackage[hidelinks]{hyperref} % Required for links and changing link options
\hypersetup{
pdfauthor={Shayan},
pdftitle={Title},
pdfsubject={Shayan's Document},
pdfkeywords={Keyword1, Keyword2},
pdfdisplaydoctitle=true,
bookmarks=true,
bookmarksnumbered=true,
breaklinks=true
}
\def\sectionautorefname{Section}
\def\subsectionautorefname{Section}
\def\figureautorefname{Figure}
\def\subfigureautorefname{Figure}
\def\chapterautorefname{Chapter}
\usepackage[printonlyused]{acronym} % Include a list of acronyms
\usepackage{rotating} % for vertical rotated text in table cells use \begin{sideways}rotated text\end{sideways}
% also for rotated figures (use \begin{sidewaysfigure})
\usepackage{multirow} % for \multirow{3}{*}{Text}
\usepackage{booktabs} % Professional tables (\toprule, \midrule, \bottomrule)
\usepackage{xtab} % Break tables across pages (see Portfolio)
\usepackage{diagbox} % Diagonal box in table
\usepackage{chapterthumb} % read the chapterthumb.sty
\usepackage[headsepline]{scrlayer-scrpage} % required for the chapterthum
\usepackage[
backend=bibtex,
style=numeric-comp,
firstinits=true,
minnames=1,
maxnames=3
]{biblatex} % decent management of bibtex
\usepackage{etoolbox} % for the following patch
% reset acronyms for each chapter
\preto\chapter\acresetall
\usepackage{metalogo} % for \TeX \XeTeX \LuaTeX \LaTeX \XeLaTeX \LuaLaTeX \LaTeXe
\usepackage[super]{nth} % for \nth{1} \nth{2} and so on
\usepackage{eso-pic}
\usepackage{bidi}% this should be the last package to load.
\quarkmarks
\renewcommand*{\tmarktl}{\registrationColour{%
\begin{picture}(0,0)
\setlength{\unitlength}{1bp}\thicklines
\put(-36,0){\line(1,0){24}}
\put(0,12){\line(0,1){24}}
\put(3,27){\normalfont\ttfamily\fontsize{8bp}{10bp}\selectfont\jobname\ \
\today\ \ \printtime\ \ Page \thepage\ \ Sheet \thesheetsequence}
\end{picture}}}
\checkandfixthelayout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment