Tag Info

New answers tagged

3

Patch the redefined \@makechapterhead to have \raggedright in the right place: \documentclass{book} \usepackage{fullpage} \usepackage[english]{babel} \usepackage[avantgarde]{quotchap} \usepackage{etoolbox} \makeatletter \patchcmd{\@makechapterhead} {\raggedleft\advance} {\raggedright\advance} {}{} \makeatother \begin{document} \chapter{Introduction} ...


2

You have defined the format for numbered chapters and using an un-numbered chapter for Abstract. Defining the format for un-numbered chapters too is needed in this case to get a rule. \documentclass[11pt,oneside]{book} \usepackage{titlesec} % Below "\section" can be replaced with "\subsection" and "\subsubsection" % in order to customize the corresponding ...


0

When you don't like the look of cm sans/lm sans, you can try the ecbright fonts. \documentclass{article} \usepackage[T1]{fontenc} \usepackage{cmbright} \usepackage{textcomp} \usepackage[utf8]{inputenc} \begin{document} Zwei Boxkämpfer jagten Quirin über den großen Sylter Deich. \$ \pounds \texteuro \end{document}


3

Note that the following suggestions are limited to chapter headings with only one line. One possibility is appending the gray rule to \chapterheadstartvskip: \documentclass{scrreprt} \usepackage[utf8]{inputenc} \usepackage{blindtext} \usepackage[T1]{fontenc} \usepackage{xcolor} \usepackage{calc} \usepackage{etoolbox} \appto\chapterheadstartvskip{% ...


2

use \titleformat{\chapter}[display]{\normalfont\bfseries}{\thechapter}{0pt}{\Large} ^^^^^^^^^^^^ or \titleformat{\chapter}[block]{\normalfont\bfseries}{\thechapter}{1em}{\Large} ^^^^^^^^ ^^^^^^^^^^^^ ^^^^ for " 1 title"


4

Latin Modern is a complete family of fonts, including serif, sans, typewriter and some other families. The following is actually a relatively small sample of what is available from Latin Modern: \documentclass{article} \usepackage{cfr-lm,microtype} \begin{document} \newcommand\dog{The quick brown fox jumped over the lazy dog.} \dog \textbf{\dog} ...


5

The ending-period stems from the fact that you're including it in the counter representations \renewcommand{\thesection}{\Roman{section}.} \renewcommand{\thesubsection}{\Alph{subsection}.} \renewcommand{\thesubsubsection}{\arabic{subsubsection}.} since \thesection (and friends) are used as-is for writing the references when using \label. Instead, you ...


2

It is quite easy to do with titlesec: \renewcommand{thesection}{\Roman{section}} \titleformat{\section}{\normalfont\large\sffamily\bfseries}%global formatting (label %and title}% {\thesection.}%label formatting {0.5em}% separation between label and title {}%commands to be applied to the title []% optional argument after title \titlespacing{0pt}{.8cm ...


0

Yet another option is to use titletoc: \documentclass{memoir} \usepackage{titletoc} \usepackage{lipsum} \newcommand\chaptertoc{ \startcontents[chapters] \printcontents[chapters]{}{1}{}} \begin{document} \tableofcontents \chapter{First chapter} \chaptertoc \section{Section A} \lipsum \section{Section B} \lipsum \chapter{Second chapter} \chaptertoc ...


5

If you want a local ToC at section level consider loading etoc and use \etocsettocdepth.toc{section} \localtableofcontents* MWE: \documentclass{memoir} \usepackage{etoc} \begin{document} \chapter{My Chapter} \etocsettocdepth.toc{section} \localtableofcontents* \section{A Section} Some text. \section{Another Section} Some more text. \end{document} ...


1

This is only for non-hyperref usage. And I don't recommend it all. Temporarily redefine \addcontentsline with 3 arguments to catch them within a \begingroup...\endgroup pair and issue the \chapter then. \documentclass{memoir} \begin{document} \begingroup \renewcommand{\addcontentsline}[3]{}% Do nothing \chapter{My Chapter} \endgroup \tableofcontents* ...


2

This doesn't happen in a new system (with a latex from 2015). In older systems load the fixltx2e package: \RequirePackage{fixltx2e} \documentclass{report} \begin{document} \chapter{1} \subsection{should be 1.0.1} \chapter{2} \subsection{should be 2.0.1} \end{document}


2

First note: I don't recommend the omittance of \section!!!! But here's a way to get the counting and counter resetting as the O.P. requests. Use the \usepackage{chngcntr} package and \counterwithin*{subsection}{chapter} -- this will reset the subsection counter each time chapter is changed and preserves the predefined \thesubsection counter format, that's ...


2

Only if you can switch to an other class: With class memoir you could use the command \chapterstyle{section} to get the desired result. \documentclass[a4paper]{memoir} \chapterstyle{section} \usepackage{blindtext} \begin{document} \blinddocument \end{document} And the class scrbook knows an option chapterprefixline=false ...


0

I extended and changed the example for class srcartcl to the following solution (You find the one for class srcbook below): \documentclass{scrartcl} \usepackage{blindtext} \usepackage[explicit]{titlesec} % change part format \titleformat{\part}[drop]{}{}{0pt}{} \titlespacing*{\part}{0pt}{0pt}{0pt} \begin{document} \tableofcontents \part{One} \blindtext ...


1

Here is a solution. ams book define section: \def\section{\@startsection{section}{1}% \z@{.7\linespacing\@plus\linespacing}{.5\linespacing}% {\normalfont\bfseries\centering}} so the solution is to delete \centering \documentclass[12pt]{amsbook} %twoside,openright are defaut option of (ams)book \makeatletter ...


0

This is the answer of Aubrey Blumsohn with some minor modifications. Aubrey's answer uses a different font for the enumeration. But more importantly this style needs less vertical space between subsections. Here I list the modifications for the sake of completeness with some test code. \documentclass[10pt,a4paper,oneside]{article} ...


5

Correct this behaviour manually by vertically skipping back to the same baseline: \documentclass[10pt]{article} \usepackage[margin=0.75in, left=1.5in]{geometry} % Section headers in margins % http://tex.stackexchange.com/a/1315/10906 \usepackage{titlesec} \titleformat{\section}[leftmargin] {\sffamily} {}{0pt}{} \titlespacing{\section} {4pc}{1.5ex ...


1

The chapter title is set with \@makechapterhead, being called within \@chapter, which is itself is used by \chapter. The normal definition of \@makechapterhead is (see book.cls) \def\@makechapterhead#1{% \vspace*{50\p@}% {\parindent \z@ \raggedright \normalfont \ifnum \c@secnumdepth >\m@ne \if@mainmatter \huge\bfseries ...


0

A preliminary solution, not finished so far! \documentclass{book} \usepackage{etoolbox} \usepackage{xparse} \newcounter{sectionlevel} \makeatletter \NewDocumentCommand{\currentdepth}{sO{}m}{% \IfBooleanTF{#1}{% }{ \ifnum\value{sectionlevel} = -1 \part[#2]{#3}% \else \ifcase\value{sectionlevel} \chapter[#2]{#3} \or ...


2

If you want to color only the lines you can load package ulem and define new commands for colored lines as suggested in its manual: \newcommand\sectionuline{% \bgroup\markoverwith{\textcolor{red}{\rule[-0.5ex]{2pt}{0.4pt}}}% \ULon% } \newcommand\subsectionuline{% \bgroup\markoverwith{\textcolor{blue}{\rule[-0.5ex]{2pt}{0.4pt}}}% \ULon% } Then you ...


2

Something like this ?. But as mentioned this will not be pretty if you use a table of contents beyond level 1. You could of course include a short bit of title or the start of your text within the \subsection{} \documentclass[10pt,a4paper,oneside]{article} \usepackage[explicit]{titlesec} ...


1

Perhaps this is what the O.P. wants to achieve? A \nameref*{}, i.e. without a link? \documentclass{article} \usepackage[bookmarksopen]{hyperref} %\usepackage{cleveref} %Well, not needed here ;-) \begin{document} \tableofcontents \section{Analysis of \nameref*{something}} \section{Model X}\label{something} \end{document}


0

I chose to add the model name after the section title. That is \section{The Grand Model of Everything (Model A)} This they the table of contents become self-contained, and I can easily refer to different models from the text.


0

I created a short command to do as @egreg suggests, avoiding this problem with the TOC and keeping a normal font size: \newcommand{\headingwithfootnote}[2]{ #1[#2]{#2{\textsuperscript{\normalsize\footnotemark}}}} ... \headingwithfootnote{\section}{Chapter Title} \footnotetext{The footnote text.}


1

First things first: the \section instruction (in standard LaTeX) does not initiate an environment. But, you kind of forsaw that you would need to change the interface with respect to the last said. At least my solution needs sections to be grouped inside environments. The conditional logic isn't that complex in the end. Say you have two conditionals ...


1

This code hopefully results in something close to what you want. I replaced loading fancyhdr with titleps, a sibling of titlesec which eases (re-)defining page styles : \documentclass[12pt,a4paper, openright, twoside]{report} \renewcommand{\contentsname}{TABLE OF CONTENTS} \usepackage[pagestyles, clearempty]{titlesec}% \usepackage{fmtcount,etoolbox} ...


3

Somebody has asked Markus Kohm a similar question. So there is now a suggestion for the headings on the KOMA-Script website (German): \documentclass[chapterprefix]{scrreprt} \renewcommand*{\chapterformat}{\thechapter\autodot} \RedeclareSectionCommand[innerskip=0pt]{chapter} \makeatletter ...


3

Here is one option: Using a special (robust) macro \bodyonlynewline as your manual line-breaking technique. This macro will only break the line inside the body text, but not the ToC. \documentclass{book} \usepackage{xparse} \usepackage[explicit]{titlesec} \usepackage{lipsum} \ExplSyntaxOn \seq_new:N \bislist \seq_set_split:Nnn \bislist {;} ...


4

Here's an option for the standard classes, using the titlesec package: The code: \documentclass{article} \usepackage{titlesec} \usepackage{lipsum}% just for the example \newlength\TitleOverhang \setlength\TitleOverhang{1.5cm} \newcommand\Overhang[1]{% \llap{\makebox[\TitleOverhang][l]{#1}}% } \titleformat{\section} ...


3

If the line above the chapter heading should only be inserted if the chapterprefix is written you could insert this line in \chapterformat. This works also for \chapter* and \addchap*. \documentclass[chapterprefix=true]{scrbook} \RedeclareSectionCommand[ beforeskip=0pt, afterskip=1\baselineskip ]{chapter} \usepackage{etoolbox} ...


3

The macro \@chapapp is initially defined to expand to \chaptername, but \appendix redefines it to be \appendixname. The standard classes define \partname and the language definition files of babel should have a definition for it. Since there's no change in \partname during the document, no other command is provided.


6

The space between chapterprefix and chapter is set by \chapterheadmidvskip. If there should be no additional space between this two lines you could use either \renewcommand*\chapterheadmidvskip{\par} or the new interface \RedeclareSectionCommand[innerskip=0pt]{chapter} \addchap changes secnumdepth locally, so \ifnumbered{chapter}. So your ...


2

Despite their name the usual way with KOMA-Script is to redefine \chapterheadstartvskip and \chapterheadendvskip: \documentclass[chapterprefix=true]{scrbook} \renewcommand*\chapterheadstartvskip{\noindent\rule{\linewidth}{4pt}\par} \renewcommand*\chapterheadendvskip{\noindent\rule{\linewidth}{2pt}\par\vspace{\baselineskip}} \usepackage{blindtext} ...


1

Here is another suggestion using \newkomafont to define a font style for this element. This also works if there is a table of contents. \documentclass{scrartcl} \newkomafont{frequentlyusedmacro}{\bfseries\itshape} \newcommand*\FrequentlyUsedMacro{{\protect\usekomafont{frequentlyusedmacro}Macro}} ...


3

I think the question is not clear enough. You are having a problem which you don't completely understand and you are asking for a particular solution that might not be what you really want. So here are a few shots in case one is exactly what you are looking for. The problem is that there's no sans serif bold italic in that particular font that comes by ...


0

I found a few solutions which I do not think are very clean. However, they might suit your needs: \documentclass{scrartcl} \newcommand\FrequentlyUsedMacro{\emph{\textbf{Macro}}} \newcommand{\startnoemph}{\let\emph\relax} \begin{document} \section{\startnoemph \FrequentlyUsedMacro{}} This works with \FrequentlyUsedMacro{}. \end{document} Or: ...


2

The formatting for the section tiles was done using titlesec with its explicit option; the formatting for the page numbers was done using a \fcolorbox, and its placement was done using fancyhdr. Only provission for the page numbers was done. The other elements in the header were not provided since they were not requested, but they can be easily done using ...


2

In TexStudio you can use the "structure" view which will open a window with the outline of you Latex document. [Click on "View" in the menu bar or press ALT then V.] You can right-click any section, copy or cut it an paste it somewhere else. All the content between the cut and the subsequent subsection will be moved. You can also indent or unident ...


0

Since you said you don't mind using another package, here's a solution that uses datetime2 instead. This package is a replacement to datetime and was designed to provide expandable commands so that the date can be used in bookmarks. Example: \documentclass[english]{report} \usepackage[en-GB]{datetime2} \usepackage{hyperref} ...


4

You need to \protect the \textcolor command: \documentclass[table,xcolor=pdftex,dvipsnames]{beamer} \usetheme{Madrid} \usecolortheme{whale} \usepackage[square]{natbib} \begin{document} \title{Presentation Title} \author{Author} \institute{Institution} \date{} \frame{\titlepage} \section*{Outline} \begin{frame} \frametitle{Outline} ...


1

The 'problem' is hyperref -- it tries to create bookmarks automatically, writing pdf string content to the bookmarks. Apparently \printdate does not provide such pdf string content. The usage of bookmarks can be prevented with bookmarks=false option to hyperref. A working solution, however, not with 'correct' date formatting in the bookmarks, is to use ...


1

Here is a solution \documentclass{article} \usepackage{hyperref} \usepackage{titlesec} \makeatletter \let\l@chapter\l@section \let\l@section\l@subsection \let\l@subsection\l@subsubsection \makeatother \begin{document} \tableofcontents \newpage \phantomsection \addcontentsline{toc}{chapter}{Chapter 1} \section{First Section} \end{document}


4

Original solution Here is a solution using enumitem and enumerate environments. Not sure wether it's really wath you asked for, since you mentioned a numbering of sections. However, with this solution, all your regularly numbered items must be in a (first level) enumerate environment, and when you need bis, ter, etc, then you can use a nested enumerate ...


4

The standard article class does not support the use of \chapters. Separation of \sections is typically achieved by using \parts: \documentclass{article} \usepackage{titlesec,hyperref} \begin{document} \tableofcontents \newpage \phantomsection \addcontentsline{toc}{part}{Chapter 1} \section{First Section} \end{document}


2

If you switch to titleps, you can use your current code and it seems to work. Better would probably be to use the package's extended support for additional sets of marks, avoiding the need for a workaround. Or, since you are using titlesec, you could probably just set the sectioning command up to avoid the need for special measures. However, without seeing ...


0

The following is just a dirty trick that smashes down the struts inside the section title; however, it does make the two pages look exactly the same (checked with \tracingoutput): \documentclass[a4paper]{article} \usepackage[margin=1in]{geometry} \usepackage{mathpazo} \usepackage{titlesec} \usepackage{hyperref} \linespread{1.05} \titleformat*{\section}{% ...


6

Here's a semiautomatic version, where you have to add the suffix by hand. \documentclass{article} \makeatletter \newcommand{\numpar}[1][]{% \par\addvspace{\medskipamount}% \if\relax\detokenize{#1}\relax \refstepcounter{numpar}% \def\thisnumpar{\thenumpar}% \else \edef\@currentlabel{\thenumpar\noexpand~#1}% ...


1

The problem is that \ref{...} is not a number, but a set of instruction for printing a number. You can use the refcount package that provides \getrefnumber that expands to 0 if the reference has not yet been established or to the reference itself. I've made some other small changes (in particular protected several end-of-lines). For part/parts the syntax ...


1

The best way to cope with formatting of section titles is to use a macro with one argument in the last argument to \titleformat. Color specifications should only go in this auxiliary macro. Here is an example. \documentclass{article} \usepackage{fontspec} \usepackage{titlesec} \usepackage{xcolor} \usepackage{lipsum} % Title/Heading Formatting % SECTION ...



Top 50 recent answers are included