Tag Info

New answers tagged

2

For a lack of the actual code, i cannot really tell why this spacing is introduced, but here a solution using KOMA-only methods. \documentclass[english]{scrbook} \usepackage[utf8]{inputenc} \usepackage{babel} \usepackage{blindtext} \KOMAoption{chapterprefix}{true} \renewcommand*\raggedchapter{\raggedleft} \addtokomafont{chapter}{\large} ...


4

A bit alternative approach: \documentclass{scrreprt} \let\raggedchapter\centering \setkomafont{chapterprefix}{\normalsize\mdseries} \KOMAoption{chapterprefix}{true} \renewcommand{\chapterheadmidvskip}{% \par\nobreak\vskip -.1cm {\rule{.9\textwidth}{.5pt}}\par% } \RedeclareSectionCommand[beforeskip=0pt,afterskip=8\baselineskip]{chapter} ...


1

I found the error, but now I just feel really stupid! It's a template I borrowed from a friend, and in the code (where I did not suspect it to be) I found \renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{-2cm} I have no idea why this is desirable, but never the less, the problem is solved.


6

Update My original answer (see below) works with both MiKTeX2.9 and TL 2015 but not with 2014 (but you can load fixltx2e to get it to work as @Johannes mentioned in a comment). So here is another suggestion. \documentclass[english]{scrreprt} \usepackage[utf8]{inputenc} \usepackage{babel} \usepackage{blindtext} \KOMAoption{chapterprefix}{true} ...


1

This just uses a \section*{\ackname} command to insert a heading and an itemize list into the document. Since there is no real information on formatting requirements, I kept it simple. (I would not use it this way, of course, let alone the names ;-)) \documentclass[11pt,a4paper,oneside]{memoir} \usepackage{blindtext} ...


3

It doesn't seem like a good idea. \documentclass{article} \usepackage{titlesec,graphicx} \titleformat{\section} {\Large\bfseries} {\thesection} {1em} {\resizetitle} \newcommand{\resizetitle}[1]{\resizebox{\sectionwidth}{!}{#1}} \newlength{\sectionwidth} \AtBeginDocument{% \setlength{\sectionwidth}{.3\textwidth}% } \begin{document} \section{Abc} ...


2

Because you are loading scrlayer-scrpage: Remove the (unnecessary) redefinitions of \sectionmark and \subsectionmark and use the possibilities of scrlayer-scrpage. \usepackage{scrlayer-scrpage} \automark{chapter}% -> section does not rewrite \markright \clearpairofpagestyles \renewcommand{\chaptermarkformat}{} \addtokomafont{pagehead}{\small} ...


1

If you're not using any sectional packages, then you can patch \@sect - used by all (unstarred) sectional commands to set the heading: \documentclass{article} \usepackage{etoolbox} \makeatletter \patchcmd{\@sect}% <cmd> {\@xsect}% <search> {\label{sec:#8}\@xsect}% <replace> {}{}% <successs><failure> \makeatother ...


1

I think \automark[section]{section} is the correct command, which will 'break' the standard section|subsection style of KOMA scrartcl class. \documentclass[twoside]{scrartcl} \usepackage{lipsum} \usepackage[header,title,titletoc]{appendix} \usepackage[automark,headsepline]{scrlayer-scrpage} \pagestyle{scrheadings} \begin{document} ...


4

Both \sectionmark and \subsectionmark should take an argument: \renewcommand{\sectionmark}[1]{}%prevent rewriting \markright \renewcommand{\subsectionmark}[1]{}%prevent rewriting \markright The \section command produces \sectionmark{<title>} and if you redefine \sectionmark to have no argument, the tokens {<title>} are not removed.


1

The following example remembers the section count in the .aux file. A counter abs@chapter is used to identify the chapter. Thus also starred or unnumbered chapters are supported. \section is redefined to write a line in the .aux file, which increases the number of sections for the current chapter. Also starred \section commands are supported. In the next ...


1

This is a quick solution with the cntperchap package (I am quite familar with its author ;-)) The key is to register counters which should be tracked on a per chapter base, here it is the section counter. Then use the \GetStoredCounterValue[chapter number]{section} macro to get the number of sections in the relevant chapter. This does not print the number ...


0

A simple code with titlesec. You can play with \titlespacing: the first argument increases the left margin, the second is vertical space before the heading,and the third vertical space after the heading. \documentclass[11pt, oneside]{book} \usepackage{showframe} \usepackage{titlesec} ...


1

The vertical spacing is controlled using \vspace*. You can set th value to your needs, negative values are also allowed, moving the text up on the page. A negative space of 105pt gives you the following output, though i cannot recommend to do that. \documentclass[11pt, oneside]{book} \usepackage{showframe,blindtext} \makeatletter ...


1

The entire titlesec module discourages the use of starred version of sectional units. As such, their usage seems may cause unexpected/unwanted results anyway. In this case, however, you're better off issuing a manual \sectionmark{<title>} to update the display in the headers. The process can be automated with the help of xparse: ...


3

The following is just an example that gives the general idea. It contains a patch of the \chapter command that is suitable for the standard book class; for other document classes, the patch could (and in general will) be different. Of course, etoolbox's \patchcmd could be used instead. \documentclass[a4paper]{book} \usepackage[T1]{fontenc} ...


2

Edit My first definition of \subimportlevel (see below) imports subfiles in a group to protect \mycurrentlevel. In this new solution, I use multiple macros (\@currrentlevel0, \@currentlevel1...) so no group is required. \makeatletter \newcounter{currentimportdepth} \setcounter{currentimportdepth}{0} \newcommand{\subimportlevel}[2]{ ...


1

In addition to this answer by Hendrik Vogt, I'd like to add that using \usepackage[explicit]{titlesec} and \titleformat{\subsection} {} {} {} {\raisebox{-0.5\baselineskip}[0pt][0pt]% \parbox{textwidth}{\fontsize{14}{16}\it\thesubsection\hspace{1ex}#1}} % raise the title will give the opportunity to use ...


7

Here is a suggestion using scrlayer to define a new pagestyle. \documentclass[12pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english]{babel} \usepackage{tikz}% loads also graphicx, xcolor \usepackage{lmodern} \usepackage[top=1.25in, bottom=1.25in, left=1.25in, right=1.25in]{geometry} ...


2

Never use " for typing in quotes. \section{Source ``Publication Title'' [authored by Tom, Dick and Harry] Published in 2000} You see that `` is used for the opening quotes and '' (two apostrophes) is used for the closing quotes. There's no need to escape [ and ], because they are printable characters so you can and should input them normally. If ...


2

You can define the chapter head for unnumbered chapter quite similar, but need to leave out the chapter number line. I added \documentclass{memoir} \usepackage{blindtext} \makeatletter \def\thickhrulefill{\leavevmode \leaders \hrule height 1pt \hfill \kern \z@} \def\@makeschapterhead#1{% \vspace*{60\p@}% {\parindent \z@ \centering \reset@font ...


2

This works without much ado. Typesetting square brackets can be done with [ and ] without any further requirements. \[ and \] are used for the display math environment, which was formerly written $$...$$ (being deprecated now!) Does it look nice? No! \documentclass{article} %\usepackage[utf8]{inputenc} not really needed \begin{document} ...


4

Using \begin{table} alone is equivalent to \begin{table}[tbp] Change all occurrences of \begin{table} in BilagC3.tex into \begin{table}[!htbp]


2

The epigraph package uses a horrible hack for realizing \dropchapter: it adds a vertical space in \@chapapp, which is not used when \chapter* is executed. Here's a version that's specific for book and report (other classes may have different \@makechapterhead and \@makeschapterhead commands), but it works for both starred and unstarred \chapter commands. ...


3

With article class as you specified in the MWE, one can employ titlesec. \documentclass{article} \renewcommand{\thesection}{\Roman{section}} \usepackage{titlesec} \titleformat{\section} {\normalfont\Large\bfseries}{Exercise~\thesection}{1em}{} \begin{document} \section{Exercise} % First exercise \section{Exercise} % Second exercise \section{Exercise} % ...


0

The relevant part of the \subsection heading is (see macro \@sect latex.ltx for example) \begingroup #6{% \@hangfrom{\hskip #3\relax\@svsec}% \interlinepenalty \@M #8\@@par}% \endgroup If this should not appear when the section level is subsection, it could be patched to use a \ifstrequal for testing if #1 is equal to subsection. I added the ...


1

This patches the \@sect command and uses a conditional to check whether the first parameter of \@sect is subsection. It applies \ul from soul package then to perform the formatting. I assumed the standard class article for this -- it does not work with scrartcl etc. \documentclass{article} \usepackage{soul} \usepackage{xpatch} \makeatletter ...


0

You can adjust the way \section works and make \section* act the same way \section does, only with some minor modifications: \documentclass{book} \usepackage{bookmark} \hypersetup{bookmarksnumbered=true} \usepackage{xparse} \makeatletter \renewcommand{\@seccntformat}[1]{\csname the#1\endcsname\space}% Just for this example \let\oldsection\section ...


1

There is a bunch of ways of adding \chapter* like titles to the ToC. I changed the \@makeschapterhead{} command for automatic entries to the ToC. The \\ has to be protected, but in my opinion, it should not used at all in a chapter title. \documentclass[14pt,a4paper,twoside,spanish,openany]{book} \usepackage[spanish,activeacute]{babel} ...


0

Footnotes seem to work as intended. When you load the KOMA-class scrextend you can use \deffootnote to define the footnote space. Here's an example on how to use it: \deffootnote[.5em]{0em}{1.5em}{\makebox[.5em][l]{\textsuperscript{\bf \thefootnotemark}}} (source)


1

Class with chapters If the class contains chapters and the "3" in "3.6" means the chapter number: \documentclass{report} \setcounter{chapter}{3} \setcounter{section}{5} \begin{document} \tableofcontents \section{First section} \subsection{First subsection} \subsubsection{First subsubsection} \section{Second section} \section{Third section} \section{Forth ...


1

Principally it's possible to set the counters of chapter andsection` accordingly, but it will look a little bit strange. Since the section counter is reset each time the chapter counter is increased, the setting of section counter must be done after \chapter is called. \documentclass{report} \usepackage{blindtext} \setcounter{chapter}{2} ...


1

\renewcomand\thechapter{3.\arabic{chapter}} \setcounter{chapter}{5} in the preamble should make the first \chapter 3.6


0

Or the simple option - use the * version. You have to do it with each section/subsection etc. but many environments have an option where * suppresses the numbering. E.g. \section*{Introduction}.


2

That code is aimed to just do the removal from sections. However, in order to remove numbering, the easiest way is to set secnumdepth to 0: \setcounter{secnumdepth}{0} I'll show also how to improve the code you were given for doing several tests. \makeatletter \renewcommand\@seccntformat[1]{\csname prepend@#1\endcsname} ...


6

Since you don't want numbering, use \setcounter{secnumdepth}{0} \documentclass{article} \setcounter{secnumdepth}{0} \begin{document} \section{A section} \subsection{A sub section} \subsubsection{A sub sub section} \end{document}


3

You have to nest the definition in this way: \makeatletter \def\@seccntformat#1{% \expandafter\ifx\csname c@#1\endcsname\c@section\else \expandafter\ifx\csname c@#1\endcsname\c@subsection\else \expandafter\ifx\csname c@#1\endcsname\c@subsubsection\else \csname the#1\endcsname\quad \fi\fi\fi} \makeatother MWE \documentclass{article} ...


2

You have code in your preamble which sets a frame the moment, you call a section. You should therefore nor put a section inside a frame here. Kind of doubled: % arara: pdflatex \documentclass{beamer} \AtBeginSection[] {% \begin{frame} \frametitle{Sommaire} \end{frame} } \begin{document} %\begin{frame} \section[]{Cadre du projet et l'├ętude ...


4

You should get a warning: Package hyperref Warning: bookmark level for unknown level4 defaults to 0. That means unknown section levels (level4, level5, ...) are treated with value 0 (chapter). The additional bookmark levels can be defined the following way: \@namedef{toclevel@level4}{4} \@namedef{toclevel@level5}{5} ... Or inside your loop: ...


2

Since floating is discouraged anyway ... % DOCUMENT TYPE \documentclass[a4paper]{book} \usepackage[english]{babel} \usepackage[margin=10pt,font=footnotesize,labelfont=bf]{caption} \usepackage{lipsum} \usepackage{fancyhdr} \usepackage{graphicx} \usepackage{pgffor} \usepackage{afterpage} \usepackage{xifthen} \usepackage[top=1in, bottom=1in, left=1in, ...


1

\documentclass{book} \usepackage{sectsty} \sectionfont{\centering} \renewcommand{\thesection}{\S\,(\roman{section})} \begin{document} \chapter{Introduction} \section{section 1} \chapter{Topics in Claims Reserving} \section{section 1} \section{section2} \chapter{Conclusion} \end{document}


2

I guess you want the number to be as high as two lines of text; here's a possibility independent of the font size (I used \Huge). The number is in the margin. Note that showframe and lipsum are not necessary; the former is used just to show the boundaries of the various parts of the page. \documentclass{report} \usepackage[T1]{fontenc} ...


7

Here's a solution using some more appropriate low level commands - but it's a bit fiddly, so titlesec might be a better way to do it. \documentclass{report} \usepackage[T1]{fontenc} \usepackage{cmbright} \makeatletter \def\@makechapterhead#1{\bgroup \moveright-1in\vbox to 0pt{\hbox{}\vskip4pt\fontsize{86}{68}\selectfont\thechapter\par\vss}% ...


2

This should work for most cases: Edit Meanwhile there is a MWE by the OP. Probably, the OP forgot to compile twice. \documentclass{report} \renewcommand{\thesection}{\arabic{section}} \begin{document} \tableofcontents \section{First} \label{firstsection} \subsection{First section} \label{firstsubsection} \end{document}


0

Suppose this is the code of book \documentclass{book} \usepackage{lipsum} \begin{document} \tableofcontents \chapter{first}% or \include \lipsum \appendix \chapter{first appe}% or \include \lipsum \chapter{first appe} \lipsum \end{document} this will be the article \documentclass{article} \usepackage{lipsum} \let\chapter\part \begin{document} ...


3

With xparse it is straight-forward to condition between starred versions and optional arguments. As such, the following redefinition of \section automatically inserts the appropriate starred version in the ToC: \documentclass{article} \usepackage{xparse} \let\oldsection\section \RenewDocumentCommand{\section}{s o m}{% \IfBooleanTF{#1} {% \section* ...


0

I derived a simpler solution from this code: Beamer-Warsaw: Reduced No. of subsections in title Except for the first page I get the three section titles right. If you dont mind only the first two titles showing up, just comment out the headline-command code for the first page. \documentclass{beamer} \usetheme{Warsaw} \makeatletter % A new section ...


2

I think there is no need to print the section number twice. Hence I would change the third argument of the \titleformat command to {\llap{\colorbox{black}{\makebox[3em][r]{\textcolor{white}{\thesection}}}\hspace{1em}}} and use {0pt} as fourth argument to align the section title with the text body. Code: ...


1

Just remove the explicit option: \documentclass[]{article} \usepackage{lipsum} \usepackage{titlesec} \usepackage[table]{xcolor} \usepackage{tikz}\usetikzlibrary{shapes.misc} \newcommand\titlebar{% \tikz[baseline,trim left=3em,trim right=3cm] { \fill [cyan!25] (2.5cm,-1ex) rectangle (\textwidth+3.1cm,2.5ex); \node [ ...


0

Use this: \renewcommand*{\thesection}{\textcolor{white}{\Roman{section}}} \documentclass[12pt,letterpaper,twoside]{article} \usepackage[margin=1in]{geometry} \usepackage[explicit]{titlesec} \usepackage{tikz} \usepackage{lipsum} \linespread{1.3} \titleformat{\section} {\normalfont\Large\bfseries} {\llap{\colorbox{black}{\makebox[3em][r] ...



Top 50 recent answers are included