Tag Info

Hot answers tagged

15

The package zref-totpages can deliver the total number of pages and with expl3 we have a powerful number crunching system. \documentclass[12pt,paper=a4]{scrbook} \usepackage{scrpage2} \usepackage{blindtext} \usepackage{zref-totpages} \usepackage{xparse} \usepackage{xcolor} \ExplSyntaxOn \NewDocumentCommand{\percentage}{} { \int_compare:nTF { \ztotpages ...


12

\documentclass{scrartcl} \usepackage{xparse} \usepackage{scrlayer-scrpage} \cfoot{\percentpagemark} \AtEndDocument{\label{last-page}} \ExplSyntaxOn \NewDocumentCommand \percentpagemark { } { \int_set:NV \l_tmpa_int { \value{page} } \int_set:NV \l_tmpb_int { \pageref{last-page} } \fp_eval:n { round( 100*\l_tmpa_int/\l_tmpb_int , 2 ) } \, \% ...


8

Another approach, with page counters and usage of calculator package. The percentage is calculated via \CalculatePercentage[]{}{}, where the first optional argument contains the number of digits for round off, the 2nd argument is the designed for the current page number and the 3rd argument holds the total number of pages. I used a different approach, ...


7

In each line of your align environment, \\ ends the equation. So, any actions you want to perform on that particular line need to go before the ending \\. \documentclass{article} \usepackage{amsmath} \begin{document} For any test function $\phi\in\mathcal{D}$, \begin{align} \langle f'(t),\phi(t) \rangle &= \int_{-\infty}^{\infty} f'(t)\phi(t) ...


6

The package documentation is your friend. \documentclass{article} \usepackage{secdot} \sectiondot{subsection} \begin{document} \section{A section} \subsection{A subsection} \end{document}


6

It may make more sense here to use a 1A, 1B, 2A, 2B, ... numbering, since the 0 and 5 doesn't seem to have any bearing on the contents: \documentclass{article} \usepackage{graphicx} \begin{document} \listoffigures \section{Figures for Proposition 1} \begin{figure}[t] \centering \includegraphics[width=0.7\linewidth, ...


5

\documentclass[10pt]{article} \usepackage{makeidx} \usepackage{multirow} \usepackage{multicol} \usepackage[dvipsnames,svgnames,table]{xcolor} \usepackage{graphicx} \usepackage[margin=0.5in]{geometry} \usepackage{epstopdf} \usepackage{ulem} \usepackage{hyperref} \usepackage{amsmath} \usepackage{amssymb} \usepackage[super]{nth} \usepackage{graphicx} ...


4

\documentclass{article} \renewcommand\thefigure{% \ifodd\value{figure}% \the\numexpr(\value{figure}-1)/2\relax.5% \else \the\numexpr\value{figure}/2\relax.0% \fi} \begin{document} \listoffigures \begin{figure}xxx\caption{zzz}\end{figure} \begin{figure}xxx\caption{zzz}\end{figure} \begin{figure}xxx\caption{zzz}\end{figure} ...


4

In order to position the left-side label, I've used some zref magic from I want to indent the next line by an exactly specified position, and therefore the solution requires at least two compilations in order for the references to settle: \documentclass{article} \usepackage{amsmath,xparse,zref-savepos} \makeatletter % Some ideas taken from ...


4

Assuming this is just an exercise, the trick is to load define a font specification for the font you intend to use. We can read the file t1txr.fd and use the data slightly modified: \documentclass[11pt,a4paper]{article} \DeclareFontFamily{T1}{txrnumbers}{} \DeclareFontShape{T1}{txrnumbers}{m}{n}{<->s*[1.2]t1xr}{} ...


4

The problem here deals with the output routine and the fact that it doesn't coincide with the gathered text at the point of page shipout (it's asynchronous). One is typically grabbing information too late, since TeX has already gather text that will form part of the following page (stepping counters and such as it's gobbling the input stream). One way around ...


3

You can use bigfoot; I'd avoid a big footnote mark NdT, preferring a footnote symbol (reset per page). \documentclass{article} \usepackage{bigfoot} \DeclareNewFootnote{default} \DeclareNewFootnote{B}[fnsymbol] \MakeSortedPerPage{footnoteB} \newcommand{\NdT}[1]{\footnoteB{\textit{NdT}: #1}} \setlength{\textheight}{8cm} % just for the example ...


3

You can use the chngcntr package: \usepackage{chngcntr} \counterwithin{chapter}{part} both will reset the chapter counter each time a new part begins and will prefix the chapter counter with the part counter.


3

Because the question doesn't include the word LaTeX, I can show the non-LaTeX solution. The first task (percent of total page) is simple with opmac's \lastpage: \input opmac \openref \footline={\rm\thefontsize[10]\hfil\the\pageno\ / \dopercent\pageno of\lastpage\hfil} \def\dopercent #1of#2{\ifnum#2=0 ??\else \tmpdim=#1 pt \multiply\tmpdim by10 ...


3

I do not know whether this is what is requested, but it is quite easy to add a non-existing section (or anything) to the TOC and use a section number in front of it. User cmhughes already pointed to \addcontentsline Please change the title and the corresponding section number. \documentclass{scrartcl} \usepackage{pdfpages} \begin{document} ...


3

Copy what subequations does, with some modifications for hyperref: \documentclass{article} \usepackage{amsmath} \usepackage{listings} \usepackage[colorlinks]{hyperref} \makeatletter \newcounter{parentlstlisting}% Counter for ``parent equation''. \newenvironment{sublstlisting}{% \refstepcounter{lstlisting}% ...


2

here's one possibility. \documentclass{article} \makeatletter \newcommand{\NdTfootnote}[1]{{% \let\@makefnmark\relax \textsuperscript{NdT}% \@footnotetext{\kern-.5em NdT. #1}}} \makeatother \begin{document} Here is some text with an ordinary\footnote{An ordinary footnote.} footnote. This text\NdTfootnote{This one is special.} needs a translator's ...


2

I'd define a new environment, to which you give the desired label as argument. \documentclass{article} \usepackage{amsmath} \makeatletter \newenvironment{varsubequations}[1] {% \addtocounter{equation}{-1}% \begin{subequations} \renewcommand{\theparentequation}{#1}% \def\@currentlabel{#1}% } {% \end{subequations} } \makeatother ...


2

Another solution needn't two compilations. It is simply \hbox / \vbox arithmetic. \documentclass{article} \usepackage{amsmath} \newdimen\prevdp \def\leftlabel#1{\noalign{\prevdp=\prevdepth \kern-\prevdp\nointerlineskip\vbox to0pt{\vss\hbox{#1}}\kern\prevdp}} \begin{document} \noindent Consider the linear program~(P) given by \begin{alignat}{2} ...


2

What you should do is reformatting the sections, subsections, &c. Redefining numbering as you do changes the section numbers are printed everywhere in the document (incl. title of contents and referencing in the text!). Here is a way, using the titlesec package. As OpenSans is not installed on my system, I repplaced it with cabin – another sansserif ...


2

If TeX generates an error as in your example (you have undefined command \del and more \left than \right) you should only look at the pdf for debugging purposes. TeX's recovery actions are designed to let it carry on, not to generate sensible typeset result. I don't know what you intended but this runs without error \documentclass{article} ...


1

Inspired by Werner's answer, I have the following answer which directly uses \marks command in etex, for resolving the conflict between header sections and background sections. \documentclass[12pt]{book} \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} \fancyhead[LE,RO]{\thepage} \fancyhead[RE]{Book Name} \fancyhead[LO]{\leftmark} ...


1

A short answer, but too long for a comment and good highlighting. It is not meant to keep it. For resetting, you have to add it the reset list (;-)) In the preamble, say after the last \usepackage{}, but before \begin{document} \makeatletter \@addtoreset{chapter}{part} \makeatother This will reset the chapter number when a new part starts!


1

The \addtocontents command is the source of the error, in my point of view, so I changed it to \addcontentsline version. However, the lab command does not seem to be well-defined in this case. Additionally, for use with hyperref, there should be a \phantomsection command before \addcontentsline. \documentclass[12pt]{book} % Book class in 12 ...


1

In UNTdissertation.sty you have: %%% This redefines the \subsection command so that it's flush left and %%% italicized. \renewcommand\subsection{\@startsection{subsection}{2}% \z@{.35\linespacing\@plus.7\linespacing}{.25\linespacing}% {\normalfont\itshape}} Hence it is not a bug, it is a feature. If your really dislike it (and like the mentioned ...



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