Tag Info

New answers tagged

6

An option using titlesec; the idea is to place the counter inside a box of width equal to the value for \parindent: \documentclass{article} \usepackage{titlesec} \usepackage{indentfirst} \usepackage{lipsum} \setlength\parindent{30pt} \newlength\mylen \setlength\mylen{\parindent} \renewcommand\thesection{\Alph{section}} \titleformat{\section} ...


2

This combines Werner's comment with a modified version of Ian Thompson's answer. Werner's suggestion Werner's suggestion resolves the problem mentioned in the question but reveals a further problem: \documentclass{book} \usepackage[a4paper, top=14mm, bottom=10mm, inner=15mm, outer=13mm, bindingoffset=10mm, includefoot, includehead, headsep=14mm, ...


0

I'm not sure why, but putting \centering in a group fixes the problem. \documentclass{book} \usepackage[a4paper, top=14mm, bottom=10mm, inner=15mm, outer=13mm, bindingoffset=10mm, includefoot, includehead, headsep=14mm, footskip=14mm]{geometry} \usepackage{titlesec} \titleformat{\chapter}[hang]{\normalfont\huge\bfseries}{\chaptertitlename\ ...


5

One way would is to save the definition of the environment thebibliography after loading natbib and let it be preceeded by the macro \@safebibliography as it normally has to be in pittetd class: \usepackage{natbib} \let\oldthebibliography\thebibliography \makeatletter \renewcommand{\thebibliography}{\@safebibliography\oldthebibliography} \makeatother ...


2

This is a design choice of the class; you can change this by redefining (or patching \@ssect@ltx). With the redefinition: \documentclass[]{revtex4-1} \makeatletter \def\@ssect@ltx#1#2#3#4#5#6[#7]#8{% \def\H@svsec{\phantomsection}% \@tempskipa #5\relax \@ifdim{\@tempskipa>\z@}{% \begingroup \interlinepenalty \@M #6{% ...


3

The class gatech-thesis.cls is buggy. You will see this odd behaviour not just with \section* but also with \subsection*, and \subsubsection* . The problem is that the class has (around line 2448) in the definition for \section, \subsection and \subsubsection: \renewcommand{\section}{% \@startsection{section}{1}{\z@}% {-3.25ex \@plus -1ex \@minus ...


5

Replicate what \tableofcontents does. For defining the English titles you have to type them just below the French one, with the macro \addtoetoc \documentclass[a4paper]{book} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[english,french]{babel} \makeatletter \newcommand\englishtableofcontents{% \if@twocolumn ...


1

Yes, this seems possible, and there even is a detailed Howto, if you are using a KOMA-script class for you document. Please have a look at the KOMA-script manual, section »Management of Tables and Lists of Contents Using tocbasic«, a way which is a bit easier is described in section 15.5: »Everything with One Command Only«, but you may read the example under ...


2

Here is a simple way with sectsty: \documentclass{article} \usepackage{sectsty} \usepackage{titlecaps} \allsectionsfont{\titlecap} \begin{document} \section{This should be title case} \subsection{This should also be title case} \end{document} This will make all sectional headings in title caps. If you want this for only section fonts, use ...


4

As mentioned by Werner in his comment, Steven Segletes's titlecaps package provides a macro called \titlecap that capitalises every word of its argument. Simply use that macro in the last mandatory argument of \titleformat from the titlesec package to typeset the heading of interest in title case. Edit: as Gonzalo Medina remarks, no need for the explicit ...


1

You can use the titlesec and titlecap packages and use the formatting command: \titleformat{\section}[hang]{\Large\bfseries}{\thesection}{\titlecap} The 1st argument after [hang] describes the global formatting of label + section title; the second argument describes commands specific to the labal and the third argument is for commands specific to the ...


2

The text in the bookmarks is not typeset: font changes are not possible and math formatting is impossible. So the best you can get is an approximate representation of the title. In this case I suggest \section{\texorpdfstring{$V^{\ast}$}{V*}} Minimal example with picture: \documentclass{article} \usepackage{hyperref} \begin{document} ...


2

With option unicode/pdfencoding=auto and psdextra, many math operators including \ast are available in bookmarks. (Option unicode is not related to the input encoding, but to the encoding of the bookmarks. Option pdfencoding=auto uses Unicode if needed, otherwise the 8-bit PdfDocEncoding is used.) \documentclass{article} ...


2

LaTeX does not directly regard \section(s) etc as having "ends": a section "ends" when a new section begins. So \section{} and its ilk are not environments, but commands which mark the beginning of a new section. What you are really concerned about here is with the way counters are used in labels. But in this your question seems to be under a ...


3

The entries for \paragraph and \subparagraph in the table of contents are set by the macros: \l@paragraph and \l@subparagraph. Usually the class contains their definition. Example for class article: \newcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}} \newcommand*\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}} ...


1

In answering, I've removed commands which caused errors and packages which were extraneous to the issue. If you just don't want the chapters numbered at all, but you do want them to show up in the contents, something like this might be suitable: \documentclass[11pt]{report} \usepackage{geometry} \geometry{letterpaper} \usepackage{remreset} \makeatletter ...


5

Using \section*{} just to get some blank vertical space is not the best way to accomplish the task; a vertical space is obtained by commands such as \smallskip \medskip \bigskip In the standard classes \smallskip is 3pt shrinkable to 2pt and (optimally) stretchable to 4pt; \medskip is 6pt shrinkable to 4pt and (optimally) stretchable to 8pt; \bigskip is ...


1

Just use \clearpage rather than \cleardoublepage: \documentclass[twoside]{report} \usepackage{hyperref} \begin{document} \tableofcontents \clearpage \phantomsection \chapter*{Left side} \addcontentsline{toc}{chapter}{Left Side} \clearpage \phantomsection \chapter*{Introduction} \addcontentsline{toc}{chapter}{Introduction} \end{document}


6

Yes, it's possible; the section number is typeset by the macro \@seccntformat and it's just a matter of giving it a suitable redefinition: typeset the number in a fixed width box. \documentclass{article} \usepackage{indentfirst} \usepackage{lipsum} \makeatletter \renewcommand{\@seccntformat}[1]{% \protect\makebox[\parindent][l]{\csname the#1\endcsname}% ...


1

I think that there is a slight mistake here. If: \DeclareRobustCommand\maybe[1]{\ifnum#1=\value{chapter}\relax\else\thechapter.\fi} is used, then the current chapter will be displayed, and not the referred chapter. I propose to use instead: \DeclareRobustCommand\maybe[1]{\ifnum#1=\value{chapter}\relax\else\uppercase\expandafter{\romannumeral#1}.\fi} ...


12

One option using TikZ (a TikZ-free solution is provided below); adjust the font attributes and lengths according to your needs: \documentclass{book} \usepackage{lmodern} \usepackage{titlesec} \usepackage{microtype} \usepackage{tikz} \definecolor{myblue}{RGB}{0,82,155} \titleformat{\chapter}[display] {\normalfont\bfseries\color{myblue}} {\filleft% ...


2

My solution consists in considering your coloured rule as a label for the section title, rather than something you add after the section title has been written With the optional arguments of \raisebox, you can make LaTeX believe it has no height,no width. So I don't have to include, rotate, &c. any graphics file; the rule is drawn, when the section ...


3

The spacing comes from the \huge in the format argument - it causes an ordinary strut to be inserted before the title is set. Instead you can use the "before code" argument of \titleformat to set the font size and also to place your graphic rule. I would also suggest that the title is placed in a narrow column raggedright, rather than in a zero width ...


3

Use the numberless feature: \documentclass{article} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Style: Fonts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{mathptmx} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ...


1

Redefining the \thesection macro will do what you want: \renewcommand{\thesection}{Q\arabic{section}}


3

Use \protect to prevent too early expansion in moving arguments such as in titles: \section{Παράδειγμα \protect\eng{Something}} Moving means here, that the titles will be copied to the table of contents as well. They should do that in their original version, not expanded, that's why the \protect. Furthermore, you could might distinguishing betweeen TOC ...


0

I went into the class file to do this. Essentially, there's something that looks like so: \renewcommand\appendix{\par\UTD@appendixtrue \setcounter{chapter}{0}% \setcounter{section}{0}% \gdef\@chapapp{\appendixname}% \gdef\thechapter{\@Alph\c@chapter}} I changed it to this: \renewcommand\appendix{\par\UTD@appendixtrue \setcounter{chapter}{0}% ...


7

It ain't pretty:-) \documentclass{article} \begin{document} \noindent X\dotfill X \noindent X\dotfill X \begin{sloppypar} \setlength\parindent{-1cm}% \setlength\leftskip{1cm} \def\par{% \ifnum\lastpenalty=-10000 \endgraf\else \leavevmode\unskip\linebreak \fi} \obeylines 1 blah blah blah blah .. blah blah blah blah.. ::: 2 blah blah blah ...


1

You make this in a wrong way Define 3 command \renewcommand{\sectionOne}[1]{\global\def\titlebar{\titlebar@}\section{#1}} \renewcommand{\sectionTwo}[1]{\global\def\titlebar{\titlebar@@}\section{#2}} \renewcommand{\sectionTree}[1]{\global\def\titlebar{\titlebar@@@}\section{#3}} moreother if you are using consécutively the same title bar style you can call ...


2

I suppose that if you have underscore characters, you might also have other characters -- such as %, &, #, and $ -- that have a special meaning in TeX. If so, you may want to use the url package and create a command \purl (short for "protected url") so that the strings in question can be parts of "moving arguments" (e.g., when they figure in the argument ...


2

I cannot really imagine the situation that requires you to be able to write _ in the title of a section, but of course, sometimes you are faced with obscure problems like that. One way of doing it is to replace \subsection{Text ABC_XYZ} by \catcode`\_=13 \def_{\textunderscore} \subsection{Text ABC_XYZ} \catcode`_=8 I will not swear that it does not ...


3

Here's another solution based on mdframed: \documentclass{article} \usepackage{enumitem} \usepackage{lipsum} \usepackage[framemethod=tikz]{mdframed} \newlength{\defparindent} \setlength{\defparindent}{\parindent} % The leftrule environment \newmdenv[ linecolor=black,% topline=false, bottomline=false, rightline=false, rightmargin=0pt, skipabove=0pt, ...


3

It seems like you're interested in a parcolumns setting: \documentclass{article} \usepackage{lipsum,parcolumns} \newcommand{\heading}[1]{\colchunk[1]{\hspace*{-\parindent}\textbf{#1}}} \newcommand{\desc}[1]{\colchunk[2]{#1}\colplacechunks} \begin{document} \begin{parcolumns}[ colwidths = {1=3cm},% 2=\dimexpr\linewidth-3cm-2em\relax rulebetween = ...


5

To the best of my knowledge, the Computer Concrete font family only comes in medium-weight shapes. In order to get LaTeX to use Computer Concrete, rather than Computer Modern, as the font in sectioning headers, you must instruct LaTeX to use only medium-weight fonts in such circumstances. One way to do so is to add the instructions \usepackage{sectsty} ...


8

Your MWE gives me the warning: LaTeX Font Warning: Font shape `OT4/ccr/bx/n' in size <14.4> not available (Font) Font shape `OT4/cmr/bx/n' tried instead on input line 10. That is there was no bold ("bx") Computer Concrete ("ccr"), so a bold Computer Modern ("cmr") was substituted. The UK TeX FAQ has a question about Concrete which ...


1

EDIT: I misunderstood the question. My answer below is for obtaining a vectorized version of the Concrete fonts. Sorry for the inconvenience. You should use the T1 encoding, the recommended 8bits encoding for almost all European languages other than English: \usepackage[T1]{fontenc} \usepackage{beton}% or ccfonts, or concrete It will load the cm-super ...


8

I am scared of the result. But anyway, you may use the explicit option of the titlesec package and define \titleformat{\section}[leftmargin] % When leftmargin is removed it works correctly {\scshape\fontsize{15pt}{18pt}\selectfont} {} {0.5em} {\textcolor{red}{#1}} Code: \documentclass{article} %%\usepackage{lmodern} %% you may need this ...


4

Column mode changes of LaTeX (without packages) are limited: Mode switches \onecolumn, \twocolumn start a new page. \twocolumn allows one column material at the top in the optional argument at least. Maximal number of columns is two. Package multicol implements several improvements: Column mode switches in the same page. More than two columns. ...


5

If you want all section titles centered, it suffices to use the starred form of \titleformat in this way: \titleformat*{\section}{\centering\normalfont\Large\bfseries} MWE: \documentclass{article} \usepackage{titlesec} \titleformat*{\section}{\centering\normalfont\Large\bfseries} \begin{document} \section{test} Some text \end{document} Output: ...


9

This is how it is done with titlesec \documentclass{article} \usepackage{titlesec,showframe} \titleformat{\section}[block] {\filcenter\Large \normalfont\bfseries} {\thesection}{0.5em}{} \titlespacing*{\section} {5pc}{*2}{*2}[5pc] \begin{document} \section{test} Some text \end{document} With sectsty: \documentclass{article} ...


2

Here is a solution, using etoolboxand stackengine. I define a \subtitlesec command, with the subtitle as an argument. This command has to be placed before the main title. I didn't check what happens with headers or title of contents, but you always can use the optional argument of section. \documentclass[11pt, twoside]{article}% ...


2

Issue the appropriate \markboth command when doing \section*; the easiest method, without plunging in the depth of the definition of \@startsection, which won't probably work with titlesec, is to redefine \section with the help of xparse: \documentclass[12pt]{article} \usepackage[compact]{titlesec} \usepackage{fancyhdr} \usepackage{lipsum} ...


1

This uses \pretocmd to patch a suitable internal latex2e macro involved in typesetting starred sections. \documentclass{article} \usepackage{hyperref}% checking compatibility \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} % clear all header and footers \let\hdrfont\relax % don't know what this font is supposed to be \AtEndDocument{\label{LastPage}} % ...


4

Although pst's solution removes the ending periods, it also changes the formatting of titles used by the Russian language. If you want to keep the default spacing defined for Russian, you'd better add these lines in your preamble, so only the period is removed, but not the correct spacing. \AtBeginDocument{% \def\postchapter{\hspace{0.5em}}% ...


2

Without \setdefaultlanguage{russian} your example doesn't have these periods, so it is something set up by especially for Russian. I don't find an option to turn that off, but you can turn the special handling off "manually" with \makeatletter \def\russian@capsformat{} \makeatother in the preamble.


2

So, similar to the last answer, you will need to pull in the lines appropriate to paragraph and subparagraph. These use some different things to make the headings, including different ways of spacing and indenting the sections. I've annotated a few things in the MWE below. See also this great answer for more about how the \@startsection command works so ...


2

This answer is heavily inspired by karlkoeller's answer, but takes a more flexible and robust approach, IMHO. His proposed solution: \renewcommand{\theHchapter}{\Roman{chapter}} works most of the time, but is not entirely foolproof either. Suppose I have a large document with nine or more Appendices, then the first Attachment will clash with Appendix 9 ...


2

This works using microtype instead, you may need to fine tune it a bit, see the microtype manual (it might be a bit hard to understand, I did not) \usepackage[T1]{fontenc} \usepackage{microtype} \newcommand\sectionFmt[1]{% \bfseries\lsstyle\MakeUppercase{#1}% } \setsecheadstyle{\sectionFmt}


5

The workaround is to add the line \renewcommand{\theHchapter}{\Roman{chapter}} just after \setcounter{chapter}{0} Hchapter is the counter used internally by hyperref (loaded by bookmark) corresponding to chapter. MWE \documentclass{memoir} \usepackage{bookmark} \begin{document} \tableofcontents \chapter{Foo} \appendix \appendixpage \chapter{First ...


1

You might try something like this in the preamble: \usepackage{titlesec} \titleformat*{\section}{\LARGE\bfseries} \titleformat*{\subsection}{\LARGE\bfseries} to set both the sizes to \LARGE. Adjust as needed.



Top 50 recent answers are included