Remove section numbers latex - latex

I have a problem with section numbering in latex. I want to remove the section numbers from headings and contents but I want the numbers to be there for lemmas, theorems etc. I want it to look like:
Section Whatever
Some unimportant text.
Section Whatever else
Another unimportant text.
Lemma 2.1
Theorem 2.2
Section Whatever again
Theorem 3.1
How can I do it? I tried
\renewcommand\thesection{}
but it removes the numbers even from lemmas and theorems. Thank you very much :)

Under the default article class we can merely remove the formatting applied to the section counter by adding
\makeatletter
\renewcommand{\#seccntformat}[1]{}
\makeatother
to the preamble. This will remove all sectional title numbering (\sections, \subsections, \subsubsections, ...), yet keep them where they are references or whenever \thesection is used.
\documentclass{article}
\newtheorem{theorem}{Theorem}[section]% Theorems numbered by section
\newtheorem{lemma}[theorem]{Lemma}% Lemma uses theorem's counter
\makeatletter
\renewcommand{\#seccntformat}[1]{}
\makeatother
\begin{document}
\section{Section whatever}
Some uninportant text.
\section{Section whatever else}
Another uninportant text.
\begin{lemma}
Some lemma.
\end{lemma}
\begin{theorem}
Some theorem.
\end{theorem}
\section{Section whatever again}
\begin{theorem}
Another theorem.
\end{theorem}
\end{document}

Related

\maketitle to use several times with combine in LaTeX

I am trying to make a .tex template for a book of abstracts for the conference. I want the template to be compilable, so the participants are able to see their abstracts separately before submitting. Moreover I want to use the files to compile the book of abstracts with table of contents and titles.
So, I have master file
\documentclass[12pt]{combine}
\usepackage{authblk}
\begin{document}
\tableofcontents
\begin{papers}
\coltocauthor{Crist\'{o}bal Josevich Junta, Fyodor Simeonovich Kivrin}
\coltoctitle{Title of the first abstract}
\import{first}
\coltocauthor{Roman Oyra-Oyra}
\coltoctitle{Title of the second abstract}
\import{second}
\end{papers}
\end{document}
And two imported files are:
\documentclass{article}
\usepackage{authblk}
\title{Title of the first abstract}
\author[1]{Crist\'{o}bal Josevich Junta}
\author[2]{Fyodor Simeonovich Kivrin}
\affil[1]{Department of the Meaning of Life}
\affil[2]{Department of Linear Happiness}
\begin{document}
\maketitle
Text of the first abstract.
\end{document}
and
\documentclass{article}
\usepackage{authblk}
\title{Title of the second abstract}
\author[1]{Roman Oyra-Oyra}
\affil[1]{Laboratory of the most unexpected sciences}
\begin{document}
\maketitle
Text of the second abstract.
\end{document}
The problem is the second \maketitle does not print authors names and their affiliation.
I have tried using redefined \settitle instead of \maketitle
\makeatletter
\newcommand{\settitle}{\#maketitle}
\makeatother
it did not help.
Also, I tried titling package, which led to no change.
I want \maketitle to print the names and affiliations or to find out the better way to automatically make titles for each abstract.

part lettering Latex

I am trying to get my document parts to show up as:
A. Narrative % \part{Narrative}
Intro %\section{Intro}
main text...
B. Appendix % \part{Appendix}
Derivations % \section{Derivations}
appendix text...
I have seen others use:
\renewcommand{\thepart}{\Alph{part}}
However this is not working for me for some reason. My parts are showing up as:
Part A
Narrative
Intro
main text...
Part B
Appendix
Derivations
appendix text...
Any ideas anyone?
The minimal example below updates \part to set its numbering differently. More specifically, it removes the \partname - Part - prefix and keeps the title on the same line. Fonts are also updated to set the part using \LARGE\bfseries in both \part and \part*. All of the above updates are done using etoolbox's \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>} macro that performs a <search>-and-<replace> within <cmd>.
\documentclass{article}
\usepackage{lipsum,etoolbox}
\renewcommand{\thepart}{\Alph{part}}
\makeatletter
% Change part display; also uniform size of \LARGE\bfseries
\patchcmd{\#part}% <cmd>
{\Large\bfseries \partname\nobreakspace\thepart \par\nobreak}% <search>
{\LARGE\bfseries \thepart.\quad}% <replace>
{}{}% <success><failure>
\patchcmd{\#part}{\huge}{\LARGE}{}{}
\patchcmd{\#spart}{\huge}{\LARGE}{}{}
\renewcommand{\#seccntformat}[1]{\csname the#1\endcsname.\quad}
% \#addtoreset{section}{part} % Reset section counter with every part
\makeatother
\begin{document}
\part{Narrative}
\section{Intro}
\lipsum[1]
\part{Appendix}
\section{Derivations}
\lipsum[2]
\end{document}
If you wish to have the \section numbers reset with every new \part, uncomment the line referencing that in the preamble.
Your idea is right, but you also redefine the titleformat.
From the following link:
\usepackage{titlesec}
\renewcommand{\thepart}{\Alph{part}}
\makeatletter
\titleformat{\part}[display]
{\Huge\scshape\filright}
{\thepart~\partname}
{20pt}
{\thispagestyle{plain}}
\makeatother

No page number for divider pages in LaTeX

I have a report in LaTeX, and i have used the following commands to create my Appendix, however, my lecturer states that any divider pages should be unnumbered.
\documentclass{report}
\usepackage{appendix}
\begin{document}
\include{chap1}
\include{appendix}
\end{document}
Then in appendix.tex
\appendix
\pagestyle{empty}
\appendixpage
\noappendicestocpagenum
\addappheadtotoc
This creates the Appendices divider page, but still puts a page number on it in the footer. There is no page number in the TOC, as expected.
How can I remove it from the footer?
I looked at the appendix.sty source, and I see the problem: line 74, in the definition of \#chap#pppage, issues a \thispagestyle{plain} command, thus overriding your \pagestyle{empty} for this page. The inelegant but direct way to fix this is to redefine the command without this line - issue the following code after importing the package.
Revised, tested version
\documentclass{report}
\usepackage{appendix}
%==== The action ================
\makeatletter
\def\#chap#pppage{%
\clear#ppage
\if#twocolumn\onecolumn\#tempswatrue\else\#tempswafalse\fi
\null\vfil
\markboth{}{}%
{ \centering \interlinepenalty \#M
\normalfont \Huge \bfseries \appendixpagename\par}%
\if#dotoc#pp\addappheadtotoc\fi
\vfil\newpage
\if#twoside
\if#openright \null \thispagestyle{empty}\newpage\fi
\fi
\if#tempswa \twocolumn\fi
}
\makeatother
%==== Back to the document ========
\begin{document}
\tableofcontents
\chapter{Blah}
Rhubarb, rhubarb, rhubarb.
\appendix
\pagestyle{empty}
\appendixpage
\noappendicestocpagenum
\addappheadtotoc
\chapter{Boff}
Cabbages, cabbages, cabbages.
\end{document}
The TeX FAQ might come in handy here:
I asked for “empty”, but the page is numbered
If you use \pagestyle{empty} and you
find some pages are numbered anyway,
you are probably encountering one of
the style decisions built into the
standard LaTeX classes: that certain
special pages should always appear
with \pagestyle{plain}, with a page
number at the centre of the page foot.
The special pages in question are
those (in article class) containing a
\maketitle, or (in book and report
classes) \chapter or \part commands.
The simple solution is to reissue the
page style after the command, with
effect for a single page, as, for
example (in article):
\maketitle
\thispagestyle{empty}
So give adding \thispagestyle{empty} after your \appendix a try.
try changing \pagestyle{empty} to \thispagestyle{empty} and put it after \addappheadtotoc.
Try instead:
\pagenumbering{gobble}
\begin{appendices} \newpage
\clearpage
\pagenumbering{arabic}
\addtocounter{page}{100}
\tableofcontents
\newpage
*Special thanks to https://tex.stackexchange.com/questions/6639/removing-page-numbers-but-not-headers!

How does one change the \paragraph formatting in LaTeX

This stems out of How can one number paragraphs in LaTeX?, which I asked earlier today:
Running with Brent.Longborough's suggestion for how to number paragraphs in a document:
\setcounter{secnumdepth}{5}
...
\paragraph{If we want to}
\paragraph{do something}
This results in LaTeX producing something likeso:
0.0.0.1 If we want to
0.0.0.2 do something
How can one change the numbering scheme of \paragraph{} to produce something like:
1. If we want to
2. do something
or alternatively
A. If we want to
B. do something
Thank you.
To change the number referenced when referring to paragraphs, you want to change \theparagraph. Here's an example:
\documentclass[12pt]{article}
\setcounter{secnumdepth}{5}
\renewcommand\theparagraph{\roman{paragraph}}
\usepackage{lipsum}
\begin{document}
\paragraph{foo} \lipsum[1]
\paragraph{bar} \lipsum[2]
\end{document}
Instead of \roman you can also use \Roman, \arabic, \alph, \Alph. Although if you have lots of paragraphs you'll want to use the alphalph package and use \alphalph to get more than 26 paragraphs.
Note that \paragraph takes an argument for the "paragraph title". If you never want that, you'll probably want to define your own command to simplify things:
\newcommand\PARA{\paragraph{}}
You'll also probably want to remove the way that paragraphs are numbered "within" sections; i.e., they reset from "1" for every new section. You can get around this with something like
\usepackage{remreset}
\makeatletter
\#removefromreset{paragraph}{section}
\makeatother

How to make 'appendix' appear in toc in Latex?

How to make word 'appendix' appear in the table of contents? Right now toc looks like this:
1 ......
2 ......
.
.
A .....
B .....
I would like it to be:
1 ......
2 ......
.
.
Appendix A .....
Appendix B .....
My latex source file structure is like this:
\begin{document}
\tableofcontents
\include{...}
\include{...}
\appendix
\include{...}
\include{...}
\end{document}
There's a couple of ways to solve this problem; unfortunately, I've only got a hack for you at this stage. One problem is that if we redefine the section number "A" to include the word "Appendix", it messes up the formatting of the table of contents. So instead, I've just defined a new sectioning command that prints the section without a number and inserts "Appendix X" manually.
Kind of ugly, but at least it works without having to change any markup :)
\documentclass{article}
\makeatletter
\newcommand\appendix#section[1]{%
\refstepcounter{section}%
\orig#section*{Appendix \#Alph\c#section: #1}%
\addcontentsline{toc}{section}{Appendix \#Alph\c#section: #1}%
}
\let\orig#section\section
\g#addto#macro\appendix{\let\section\appendix#section}
\makeatother
\begin{document}
\tableofcontents
\section{goo}
\label{a}
This is sec~\ref{a}
\section{har}
\label{b}
This is sec~\ref{b}
\appendix
\section{ji}
\label{c}
This is app~\ref{c}
\subsection{me}
does this look right?
\end{document}
For my thesis, I did the following:
\appendix
\addcontentsline{toc}{section}{Appendix~\ref{app:scripts}: Training Scripts}
\section*{Sample Training Scripts}
\label{app:scripts}
Blah blah appendix content blah blah blah.
Explanation: I manually added a line to the TOC so I would have "Appendix X:..." show up in my TOC. Then I excluded the actual section command from the TOC by using an asterisk.
This is probably most easily achieved by using the appendix
package, or the memoir class.
If you don't want to use a prepackaged solution, you'll have to
hack the sectioning commands. When I needed to do this for my
dissertation, I cloned the report class, and edited until I made
the margins lady happy. What you're looking for is the
definition of the \addcontentsline macro.
The appendix package is really good and simple solution. My answer can be helpful for who wants to change chapters numbering style, for example, with using cyrillic alphabet or roman digits. The appendices numbering style is hardcoded in the \#resets#pp command (I looked in sources here http://hal.in2p3.fr/docs/00/31/90/21/TEX/appendix.sty). I solved it by simple redefining this command to my own. Just add this code into your preamble:
\makeatletter
\renewcommand{\#resets#pp}{\par
\#ppsavesec
\stepcounter{#pps}
\setcounter{section}{0}
\if#chapter#pp
\setcounter{chapter}{0}
\renewcommand\#chapapp{\appendixname}
\gdef\thechapter{\Asbuk{chapter}} % changed
\else
\setcounter{subsection}{0}
\gdef\thechapter{\Asbuk{section}} % changed
\fi
\if#pphyper
\if#chapter#pp
\renewcommand{\theHchapter}{\theH#pps.\Asbuk{chapter}} % changed
\else
\renewcommand{\theHsection}{\theH#pps.\Asbuk{section}} % changed
\fi
\def\Hy#chapapp{\appendixname}%
\fi
\restoreapp
}
\makeatother
As a result,
Appendix A
Appendix B
Appendix C
...
will change to
Appendix A
Appendix Б
Appendix В
... etc
I'm not a latex expert, and I can't guarantee this code won't break something else.
Based on #Will Robertson's answer, the code below defines the same thing but for chapter and also fixes the fact that chapter* does not add to the header when using the fancyhdr package.
With this in the preable all issues are resolved.
\makeatletter
\newcommand\appendix#chapter[1]{%
\refstepcounter{chapter}%
\def\app#ct{Appendix \#Alph\c#chapter: #1}
\orig#chapter*{\app#ct}%
\markboth{\MakeUppercase{\app#ct}}{\MakeUppercase{\app#ct}}
\addcontentsline{toc}{chapter}{\app#ct}%
}
\let\orig#chapter\chapter
\g#addto#macro\appendix{\let\chapter\appendix#chapter}
\makeatother

Resources