New answers tagged

2

To give you something to start with: \documentclass{book} \usepackage{xcolor} \usepackage{titlesec} \usepackage{hyperref} \usepackage{graphicx} \usepackage[percent]{overpic} \usepackage{fix-cm} \usepackage{lipsum} % formats: \chapter \newcommand\ctformatchapter[1]{% \parbox[b][6cm][b]{\dimexpr.5\textwidth\relax}{% \raggedright% \...


1

This uses a switch for the individual styles, \questionanswer for the first part and \problemanswer for the 2nd part. The \if@questionmode checks whether the current section is the question or the answer -- no gaps between questions are assumed! \documentclass{book} \usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,letterpaper]{geometry} \...


4

To add a dot after the chapter number in the title of the chapter only, you need to patch \@makechapterhead: \usepackage{etoolbox} \makeatletter \patchcmd{\@makechapterhead}% <cmd> {\thechapter}% <search> {\thechapter.}% <replace> {}{}% <success><failure> \makeatother To add a dot after the (any) sectional number in its ...


1

Like with most sectioning commands, there is a mark associated with \book, called \bookpagemark. It's default setting is similar to \@gobble as it just prints/does nothing with its argument. You can change this to \rightmark, which will set it for the odd-side pages: \documentclass[twoside]{memoir} \usepackage{lipsum} \title{Generic Document} \...


3

Perhaps this is a possible solution, using a \section*{foo}* variant defined with xparse's \NewDocumentCommand -- the syntax is unusual, but the normal \section* is preserved then. \documentclass[10pt,a6paper]{book} \usepackage[utf8]{inputenc} \usepackage[main=english,slovak]{babel} \usepackage[cm]{fullpage} \usepackage[a6paper, top=10mm, left=10mm, right=...


2

Titlesec defines several shapes for section titles. Among which: [hang] is LaTeX default shape for section: label and section title aligned, staring from the left margin; [block] puts label and section title in a paragraph. Useful for centred section titles or with picture inclusion, for instance; [display] outs the label in a paragraph of its own, like ...


1

Use the dedault and don't confuse yourself with self made trouble. \documentclass[a4paper, numbers=noenddot]{scrbook} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{csquotes} \usepackage{hyperref} \begin{document} \appendix \chapter{Animals} \section{Wombat} \section{Capybara} \section{Mara} \chapter{People} \section{Donald} \...


2

Since the logical structure of a document follows a hierarchy, and you would only be interested in the title of a higher element in the hierarchy, the following elementary patch to \@sect works: \documentclass{article} \usepackage{etoolbox} \makeatletter \pretocmd{\@startsection}{\gdef\thesectiontype{#1}}{}{} \pretocmd{\@sect}{\@namedef{the\...


1

Due to lack of time only a preliminary solution, not patching etc. \section etc. The code redefines \section etc. slightly, using the old version and appends the definition of \thesectionname at the end. However, using \thesubsectionname in the next section this would lead to wrong names, so I used the \@elt trick to kill recursively all \the...names at ...


3

Using \newcommand{\currentname}{\@currentlabelname} has no effect. It would refer to the current value of \@currentlabelname or is even undefined. In fact, the \@currentlabelname must be stored in an expansion step to another macro after the section title has been set, not in the argument. Please note that the current definition of \tree... misses the ...


1

Use a \chapter*. Some other modification are also needed in order to place the appendix in the ToC (if needed) and update the headers: \documentclass{book} \usepackage{lipsum} \begin{document} \tableofcontents \chapter{A chapter} \lipsum[1-10] \appendix \chapter*{Appendix 1} \addcontentsline{toc}{chapter}{Appendix 1}% Add Appendix to ToC \markboth{...


1

Here is a suggestion that needs KOMA-Script version 3.20 or newer: \documentclass[ oneside, numbers=noenddot, appendixprefix ]{scrbook}[2016/05/10]% needs version 3.20 or newer \usepackage{blindtext}% dummy text \usepackage{xpatch} \xapptocmd{\appendix}{% \addtocontents{toc}{% \RedeclareSectionCommand[ tocdynnumwidth, ...


0

"Macro Tracker" Solution update 2016-07-12 Based on Werner's code, I came up with a nice logging solution. On the journey to producing a clean log output: ############################################################################## Document Diagnostics ############################################################################## Main File: logs....


0

The following MWE will show how to indent \subsection content by \parindent. \documentclass{article} \usepackage{lipsum} \usepackage{titlesec} \titleformat{\subsection}[runin]{\itshape}{\thesubsection.}{3pt}{\space}[.] \titlespacing*{\subsection}{\the\parindent}{1ex}{1em} \parindent=1pc \begin{document} \section{Section Title} \lipsum[1-2] \subsection{...


0

It can be done using the commands \rhead and \lhead. The code for box around the header is took from this answer. \documentclass[a4paper,12pt,oneside]{book} \usepackage[top=1.0in, bottom=1.0in, left=1.0in,right=1.0in,bindingoffset=2.3cm]{geometry} \usepackage[lenny]{fncychap} \usepackage{fancyhdr} \cfoot{\thepage} \pagestyle{fancy} \usepackage{lipsum} \...


0

The macro \story combines the table of contents from \chapter and the title from \chapter*. I also eliminated the "short title" option for simplicity. The float stuff is probably unnecessary. I eliminated all the Nowegian stuff since it should have no bearing and I can't test it anyway. \documentclass[oneside]{book} \usepackage{lipsum} \makeatletter \...


0

Here is a solution \documentclass{article} \usepackage{mwe} \usepackage{xcolor} \makeatletter \renewcommand\section{\@startsection {section}{1}{\z@}% {0pt}% {0pt}% {\normalfont\Large\bfseries\mybox}} \makeatother \newcommand*{\mybox}[1]{% \noindent\...


1

Change afterskip for paragraph and subparagraph to a positive value using: \RedeclareSectionCommands[ afterskip=1sp ]{paragraph,subparagraph} Note that 1sp is the smallest possible positive value. Code: \documentclass[parskip]{scrbook} \setcounter{secnumdepth}{5} \RedeclareSectionCommands[ afterskip=1sp ]{paragraph,subparagraph} \begin{document} ...


3

I'm not sure, but I think you want \documentclass[a4paper,dvipsnames]{article} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{amsmath} \usepackage[colorlinks=true]{hyperref} \hypersetup{linkcolor=black} \usepackage{cleveref} \usepackage{chngcntr} \counterwithin*{equation}{section} \counterwithin*{equation}{subsection} \counterwithin*{...


1

Counters bound to other counters are reset when the master counter is “stepped” with \stepcounter. So I guess that \newcommand{\sect}[1]{% \stepcounter{section}\addtocounter{section}{-1}% \section*{#1}% \addcontentsline{toc}{section}{#1}% } is what you really want. Unless you want that \section{A} \sect{B} \section{C} gives 3 as the section ...


3

It is not recommended - see tex.stackexchange.com/a/300541/43317 and komascript.de/node/2039 (German) - but possible with KOMA-Script version 3.19 or newer: \documentclass[parskip=full-]{scrartcl}[2015/10/03] \RedeclareSectionCommand[afterskip=1sp]{section} %the magic happens here \usepackage{xpatch} \xapptocmd\sectionlinesformat{\vspace*{-\parskip}}{}{\...


2

One can argue about this approach: A reset equation in each \section* is without information which section is meant actually, so cross-referencing might become difficult, unless hyperref is used with correct linking. In this solution I applied \xpretocmd for \section to reset the equation counter (which is probably done anyway), so both for \section and \...


0

I use this redefined command to create sections without numbering but it keeps adding-up: \newcommand{\sect}[1] {\section*{#1}\addcontentsline{toc}{section}{#1}\addtocounter{section}{1}} Also in table of contents, of course.


0

The redefinition of \sectionmark is wrong. However, since you seem to be redefining \sectionmark and \chaptermark just to get rid of headers, there's a much simpler solution: clearing all fields before redefining them. I added also the code for using the same style also in chapter starting pages (but omitting the top rule). \documentclass[12pt]{report} \...


3

\sectionmark is defined in the standard classes (such as report.cls) to have one argument. Omitting it, the \section code calls \sectionmark{foo} this way: \sectionmark% does nothing if being defined as `\renewcommand{\sectionmark}{}` foo i.e. the orphaned argument foo appears in the input stream, i.e. it is typeset (in most cases, in rare cases it ...


3

scrartcl is a KOMA-Script class. So you can use \newcommand{\fakesubsection}[1]{% \subsectionmark{#1}% add subsection mark (header) \addsubsectiontocentry{}{#1}% add as subsection to ToC } to add this text as subsection without number to the table of contents. Update using scrreprt which provides chapters (based on the MWE and the informations in ...


2

Please provide a minimal working example (MWE) next time you ask a question... I hope this is what you are looking for. Here I define a new command \daggerfootnote to be used in such cases. It doesn't interfere with other footnotes numbering, as you can see. MWE: \documentclass{article} \newcounter{daggerfootnote} \newcommand*{\daggerfootnote}[1]{% \...


4

The reason why the OP example fails is the reset of the section counter without taking into account that \theHsection should be changed too -- doing so will lead to correct hyper anchors. The appendix package takes care of this and \begin{appendices}...\end{appendices} should be used in order to get everything setup, as well as the toc option, if needed (...


1

This redefines \@memb@bchap and uses subsection instead of chapter for \addcontentsline. \begin{filecontents*}{chapter1.bib} @article{ref1, author={Name, F.L}, journal={J. Am. Chem. Soc}, pages={1134--1145}, } \end{filecontents*} \documentclass[oneside,openany,openbib,11pt]{memoir} \usepackage{etoolbox} \usepackage{...


1

Here is a solution. We use this patch \let\mtaddcontentsline\addcontentsline \newcommand{\mtchaptoc}{% \def\addcontentsline##1##2##3{% \mtaddcontentsline{##1}{subsection}{##3} \let\addcontentsline\mtaddcontentsline}} \pretocmd{\bibliography}{\mtchaptoc}{}{} MWE \begin{filecontents*}{chapter1.bib} @article{ref1, author={Name, F.L}, ...


3

You can use \setupglossaries to modify some (but not all) of the settings that can be used in the package options. Fortunately the settings you want adjusted may be changed in the document. First with \setupglossaries{numberedsection=autolabel} and then with \setupglossaries{section,numberedsection=nameref} Modified MWE: \documentclass{scrbook} \...


1

To answer the OP's comment, what you can do is something like this In \titleline define it to display \myfavouritestring. Re-define the chapter command to take a second argument, and set \myfavouritestring accordingly. E.g. \newcommand\mychapter[2]{\renewcommand\myfavouritestring{#2} \chapter{#1}} Remember in your preamble to define \newcommand\...


4

You have to define \l@subsubparagraph, e.g. \makeatletter \newcommand\l@subsubparagraph{\@dottedtocline{6}{14em}{7em}} \makeatother The first argument of \@dottedtocline defines the toclevel of \subsubparagraph. Code: \documentclass{article} \usepackage[raggedright]{titlesec} \setcounter{secnumdepth}{5} \setcounter{tocdepth}{5} \titleformat{\...


1

You can redefine \sectionmark to suit your needs. Additionally, I've added what's needed for the Page ##/total (see How can I add "page # of ##" on my document?). \documentclass{article} \usepackage{fancyhdr,lastpage,lipsum} \pagestyle{fancy} \fancyhf{} \fancyhead[L]{Section~\leftmark} \fancyhead[R]{Page \thepage/\pageref{LastPage}} \...


1

If you want that the header contains just “Section 1” (or whatever the section number is), redefine \sectionmark: \renewcommand{\sectionmark}[1]{\markright{\thesection}} (the word “Section” is already supplied by the other code). This way, \rightmark will contain the current section number.


4

The line \renewcommand{\sectionmark}[1]{\markright{\arabic{section}.\ #1}} sets the section mark to consist of - the section number as a Arabic numeral - followed by a fullstop and space - followed by the section name Just us \renewcommand{\sectionmark}[1]{\markright{#1}} instead to remove the number and accompanying punctuation. \...


0

This worked for me: \chapter*{Introduction}\stepcounter{chapter}\addcontentsline{toc}{chapter}{Introduction} Place that code at the beginning of your chapter.


1

Here's the centered \section* version with code from latex.ltx (as is used in standard classes) \documentclass{article} \makeatletter \def\@sect#1#2#3#4#5#6[#7]#8{% \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname.\hskip 0.6em} \begingroup \ifnum #2=1\bf\centering {\interlinepenalty \@M \large{\@svsec #8}\par}\else\...


7

This was caused by \value{0}, which is not valid. Simply 0 is enough. use \value only when accessing counters, as you do with \value{chapter}. Also, you don't need to use \makeatletter/ \makeatotherhere. See What do \makeatletter and \makeatother do?, though I suspect you already know this. Output Code \documentclass{memoir} \usepackage[utf8]{inputenc}...


16

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}}% \...


11

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 ...


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 ...



Top 50 recent answers are included