Hot answers tagged

11

Define an environment within which counter stepping and ToC-writing is disabled. This allows great freedom: \documentclass{article} \usepackage{xparse} \newcounter{savesection} \newcounter{savesubsection} \newcounter{savesubsubsection} \newenvironment{quietsections} {% Store sectional counters \setcounter{savesection}{\value{section}}% \...


7

UPDATE at the end, with automatic restoration of arbitrary counters!!!! Use a dummycounter that resets with the upper section level and \let\c@subsection\c@dummycounter, i.e. explicitly use the count register c@dummycounter instead of c@subsection If this is used inside of the minipage, the \let operation does not leak outside (since minipage is an ...


4

Using \ifcase...\fi conditional in advance (requires the relevant chapter prefixes to be defined in advance, of course too!) \documentclass{book} \usepackage{tocloft} \addtolength{\cftchapnumwidth}{20pt} \addtolength{\cftsecnumwidth}{20pt} \renewcommand{\thechapter}{% \ifcase\value{chapter} \or LAW% \or VNR% \or FOO% \or FOOBAR% \or ...


4

It's certainly possible: \documentclass{book} \makeatletter \newcommand{\chapterkey}[1]{% \renewcommand{\chapter@key}{#1}% } \newcommand{\chapter@key}{???} % initialize \renewcommand{\thechapter}{\chapter@key} \makeatother \begin{document} \chapterkey{LAW} \chapter{foo} \section{Problems} \section{Solutions} \chapterkey{VNR} \chapter{bar} \section{...


4

For fun, here is a solution in ConTeXt. Some remarks: I use OCR-A font to match the font used in the movie. I use three shades of green. Colors are defined in the HSV colorspace and the three colors just have different saturation values. I use a TABLE for typesetting for ease of use. One could have used a simple \halign as well. For ConTeXt users, this ...


4

Here is a suggestion using the random function: \documentclass[svgnames]{report} \usepackage{tikz} \colorlet{Random0}{white} \colorlet{Random1}{green} \usepackage{kpfonts} \usepackage[explicit]{titlesec} \newcommand*\chapterlabel{} \titleformat{\chapter} {\gdef\chapterlabel{} \normalfont\sffamily\Huge\bfseries\scshape} {\gdef\chapterlabel{\...


3

Perhaps KOMA classes provide better ways, but \@currentlabelname has to be set (alternativle \NR@gettitle) to be effective with nameref, i.e. use the optional argument value #2 as content of \@currentlabelname! \documentclass{scrreprt} \usepackage{hyperref} \usepackage{cleveref} \usepackage{xparse} \makeatletter \let\latex@@section\section \...


3

Adding a \strut to your first code ensures the same size. If you wanted to set the height to a lower value, you should replace \makebox with a \parbox, where you can control the height and width of the box. The syntax is \parbox[verticalPos][height][horisontalPos]{width}{text}. Example \parbox[b][.8ex][l]{.7em}{text} \documentclass[11pt]{memoir} \usepackage[...


2

With a KOMA-Script class you can use \addsec. Then it is possible to define a short title in the optional argument. \documentclass{scrreprt} \usepackage{hyperref} \usepackage{cleveref} \begin{document} \tableofcontents \chapter{chapter} \section[short title 1]{Long Title Section One}\label{sec:One} In \cref{sec:One} (\nameref{sec:One}) I refer to \nameref{...


2

Here is a solution Notes The solution use (la)TeX loop. File names changed 1_1_1 -->1+1+1 (this is easier) \documentclass{article} \usepackage{lipsum} \setcounter{secnumdepth}{4} \newif\ifmoreinput \newcounter{sec} \newcounter{ssec}[sec] \newcounter{sssec}[ssec] \newcounter{parg}[sssec] \begin{document} \loop \stepcounter{section}% \stepcounter{sec}...


2

This approach may not be a good idea, LaTeX is designed to take care of the numbering for you (for example when you decide later to add a section between 1 and 2). If you want to do it anyway, a scripting language is probably the easiest way. Example in Perl: use File::Find; use Cwd; # get working directory for script $cwd1 = getcwd(); # find all tex ...


2

The bug is fixed in KOMA-Script Version 3.21 which is the current version on CTAN, in TeX Live 2016 and in MiKTeX. \documentclass{scrartcl}[2016/06/14] \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{xcolor} \usepackage{scrlayer-scrpage} \addtokomafont{section}{\color{red}} \addtokomafont{pageheadfoot}{\color{blue}} \begin{document} ... \\...


1

A big issue you have to deal with is expandability of content, since you're writing to the terminal. To get around this, I define two versions of your \myapp and \myproduct functions. The regular \myapp and \myproduct are declared to be robust, while \@myapp and \@myproduct are expandable and simplified versions of their counterparts (removing font-related ...


1

Is this what you want? \documentclass{article} \usepackage{fontspec}% use xelatex \usepackage{titlesec}% adds \thetitle and \@currentlabelname \usepackage{nameref} \usepackage{regexpatch} \usepackage{currfile}% adds \currfilepath % Define a couple commands to track \newcommand\myapp[1]{\textit{#1}} \newcommand\myproduct[1]{MacGyver.\textit{#1}}% ...



Only top voted, non community-wiki answers of a minimum length are eligible