I am trying to write a document which uses seperate numbers for sections and paragraphs.
I would like each \paragraph to have a hanging indent such that the first word of the second line, aligns with the first word of the first line.
Here is my code:
\documentclass{article}
\usepackage{a4wide}
\usepackage[english]{babel}
\usepackage{titlesec}
% Heading/Subheading counter
\newcounter{subsubsection}[subsubsection]
\newcounter{param} % Paragraph counter
\newcommand{\N}{%
\noindent\refstepcounter{parnum}%
\makebox[\parindent][l]{\arabic{parnum}.}}
\newcommand\YUGE{\fontsize{60}{100}\selectfont}
% Paragraph style
\renewcommand\thesubsubsubsection{\thesubsubsection.\arabic{subsubsubsection}}
\renewcommand\theparagraph{\thesubsubsubsection.\arabic{paragraph}}
\makeatletter
\renewcommand\paragraph{\#startsection{paragraph}{5}{\z#}%
{1em} {-1em} {\normalsize\normalfont}}
\def\toclevel#subsubsubsection{4}
\def\toclevel#paragraph{5}
\def\l#subsubsubsection{\#dottedtocline{4}{7em}{4em}}
\def\l#paragraph{\#dottedtocline{5}{10em}{5em}}
\makeatother
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\section{Scope}
\pagestyle{style1}
\paragraph*{\N} The Scope of this document should number each paragraph sequentially:
\begin{itemize}
\item [a.] List item 1,
\item [b.] List item 2, and
\item [...] ...
\item [n.] List item n.
\end{itemize}
\paragraph*{\N} Second paragraph with numbering
\subsection{Intro}
\paragraph*{\N} This is the intro.
\paragraph*{\N} Intro cont.
\subsubsection{related docs}
\paragraph*{\N} Here is a list of the related docs
\begin{itemize}
\item [a.] ...
\end{itemize}
\end{document}
This is a picture of what it looks like currently.
Here is a quick example in word as to how I want the paragraphs to work (disregard the different numbering and font type. I am only concerned with the hanging indent).
I found the answer; You need to use the following packages
\usepackage{titlesec}
\usepackage{etoolbox}
Then you need to set the counter depth for the document to 5 and define a new counter. Which means you will be countering every; chapter, section, subsection, subsubsection, paragraph and subparagraph.
\setcounter{secnumdepth}{5}
\newcounter{para}
\newcommand{\N}{\noindent\refstepcounter{para}\makebox[\parindent][l]{\arabic{para}.}}
Now you can set up the format for each of the sections/subsections/paragraphs/etc
\newlength\titleindent
\setlength\titleindent{1.25cm}
\pretocmd{\paragraph}{\stepcounter{subsubsection}}{}{}
\titleformat{\section}{\normalfont\Large\bfseries}{\llap{\parbox{\titleindent}{\thesection\hfill}}}{0em}{}
\titleformat{\subsection}{\normalfont\large\bfseries}{\llap{\parbox{\titleindent}{\thesubsection\hfill}}}{0em}{}
\titleformat{\subsubsection}{\normalfont\normalsize\bfseries}{\llap{\parbox{\titleindent}{\thesubsubsection}}}{0em}{}
\titleformat{\paragraph}[runin]{\normalfont\normalsize}{\llap{\parbox{\titleindent}{\N\hfill}}}{0em}{}
\titlespacing*{\subsubsection}{0pt}{2ex plus 1ex minus 0.2ex}{1.5ex plus .2ex}
\titlespacing*{\paragraph}{0pt}{2ex plus 1ex minus .2ex}{0ex plus 0ex}
I did not use the subparagraph option to I changed the commands such that the numbering of paragraphs is the same level as subsubsections. This means a subsubsection might be numbered 1.2.1 if you have two paragraphs though the next subsubsection will be 1.2.4 is an issue I have yet to solve.
The below is the original commands:
\pretocmd{\paragraph}{\stepcounter{subsection}}{}{}
\pretocmd{\subparagraph}{\stepcounter{subsubsection}}{}{}
Importantly when writing your code, you need to use the following syntax at the beginning of each paragraph:
\paragraph{} Some text
Here is an example
\begin{document}
\section{title}
\subsection{Intro}
\paragraph{} The Scope of this document should number each paragraph sequentially:
\begin{itemize}
\item [a.] List item 1,
\item [b.] List item 2, and
\item [...] ...
\item [n.] List item n.
\end{itemize}
\paragraph{} Second paragraph with numbering, this is sample text to explain the
hanging indent format, which should align with the second line of this paragraph
with the first line.
\subsection{Intro}
\paragraph{}This is the intro, this is sample text to explain the hanging indent
format, which should align with the second line of this paragraph with the first
line.
\paragraph{} Intro cont, this is sample text to explain the hanging indent format,
which should align with the second line of this paragraph with the first line.
\subsubsection{related docs}
\paragraph{} Here is a list of the related docs
\begin{itemize}
\item [a.] ...
\end{itemize}
\end{document}
This is what it looks like now
Related
I am trying to cross reference some numbered paragraphs. I am using \numpar but the first one always is off aligned. (\item didn't work)
Here is what I did:
\section{First section}
\subsection*{Subsection1}
\numpar\label{A1} blablabla1
\numpar\label{A2} blablabla2
\numpar\label{A3} blablabla3
\section{Second section}
Statement \ref{A2} = 2 must be true.
which results in:
I need all numbers to be aligned without affecting on unnumbered paragraphs. I am open to other commands instead of \numpar if any. Any advice is appreciated.
Why don't you use enumerate? It is done for that kind of problem.
\documentclass{article}
\begin{document}
\section{First section}
\subsection*{Subsection1}
\begin{enumerate}
\item \label{A1} blablabla1
\item \label{A2} blablabla2
\item \label{A3} blablabla3
\end{enumerate}
\section{Second section}
Statement \ref{A2} = 2 must be true.
\end{document}
If required, you can customize the appearance with the enumitem package.
For instance, to increase the indentation, load the package, and start enumerate with :
\begin{enumerate}[leftmargin=3cm]`
Many options in the enumitem package and it can certainly fit your needs.
Edit:
Note that \item will indent anything that is after it. If you dont want this behavior, close the enumerate before your paragraph. Then you can restart the enumerate, but you must take care of the item numbering (see below).
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\section{First section}
\subsection*{Subsection1}
\begin{enumerate}
\item \label{A1} blablabla1
This paragraph will be indented
\end{enumerate}
But this one will not.
\begin{enumerate}\setcounter{enumi}{1}
% This insures that item numbering will be coherent
% set it to the value of the last item
% If using the enumitem package, there is a simpler way with 'resume'
% \begin{enumerate}[resume]
\item \label{A2} blablabla2
\item \label{A3} blablabla3
\end{enumerate}
And another non indented par
\section{Second section}
Statement \ref{A2} = 2 must be true.
\end{document}
I just started learning Latex and I have this code in which I first define a figure which is a photo and then I want to have items in my PDF file.
But the output file isn't so and it first shows the items and then the photo! even though I have [!h] statement too.
\documentclass[12pt]{report}
\begin{document}
\begin{figure}[!h]
\centering
\includegraphics[width= 90mm]{./class.jpg}
\caption{pic1}
\end{figure}
\begin{enumerate}
\item first option with number
\item second option with number
\end{enumerate}
\end{document}
What I do is to use the package float and change !h for H
\documentclass[12pt]{report}
\usepackage{float}
\begin{document}
\begin{figure}[H]
\centering
\includegraphics[width= 90mm]{./class.jpg}
\caption{pic1}
\end{figure}
\begin{enumerate}
\item first option with number
\item second option with number
\end{enumerate}
\end{document}
This forces latex to place the image right in the position you put it.
When I compile your code with \usepackage{graphicx}, and using a generic image, I first get the image, then the item list. Usually LaTeX will force the image onto the next empty page, if the image is too large (the width may fit, but possibly the height is off?). Maybe try playing with \includegraphics[scale=0.8].
I am looking for a LaTeX environment, that is capable of formatting given paragraph(s) with a slight indentation and increasing line counters within parenthesis, e.g.:
(1) Lorem Ipsum
(2) Dolor Sit
These numbers should continue to increase throughout the document, i.e. there should be no number used twice. It would behave almost like the align environment- including the possibility to \ref to individual lines, except that I do not wish to use it for math but rather for text snippets.
Unfortunately, I am not that LaTeX savvy, so I cannot really define such an environment myself.
Is this what you're looking for?
\documentclass{article}
\usepackage{lipsum} % just for blind text
\usepackage{enumitem}
\newlist{masterlist}{enumerate}{1}
\setlist[masterlist]{label=(\arabic*),resume}
\begin{document}
\lipsum[1]
\begin{masterlist}
\item foo
\item bar
\end{masterlist}
\lipsum[2-3]
\begin{masterlist}
\item baz
\item boo
\end{masterlist}
\end{document}
In fact you want an enumerate list with number in a non default presentation. An easy way for this is the enumerate package:
\documentclass{article}
\usepackage{enumerate}
\begin{document}
\begin{enumerate}[(1)]
\item test1
\item test2
\end{enumerate}
\end{document}
You could use the align environment (or other math-based environments) and typeset your text using \text{...}. Example:
\begin{equation}\label{mylabel}
\text{Numbered like an equation, typeset like text.}
\end{equation}
Beware, though, that this is only suitable for short snippets of text, since you are, after all, inside a math environment, so there's no automatic line wrapping.
I'm trying to make alignment points in a list environment. The following code gives me an error, but it almost compiles to what I want, just missing the bullet points. I must be misunderstanding something about align and/or tabular and how they work with linebreaks. Guidance appreciated!
\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{Title}
\begin{itemize}
\begin{tabular}{ll}
\item Topic Apple: &Something to say about it \\
\item Topic Watermelons: &Something different
\end{tabular}
\end{itemize}
\end{frame}
\end{document}
How about this?
\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{Title}
\begin{tabular}{p{0.4\textwidth}p{0.5\textwidth}}
\begin{itemize}
\item Topic Apple:
\item Topic Watermelon:
\end{itemize} &
\begin{itemize}
\item[] Something to say about it
\item[] Something to say about it
\end{itemize} \\
\end{tabular}
\end{frame}
\end{document}
Yours will actually work if you change {ll} to {p{width}l} or {p{width}p{width}} but I found that if you don't have itemize in the second column, your text ends up vertically top aligned while the itemized text in the left column is center (or maybe even slightly bottom) aligned vertically so it doesn't look good.
I tried using the array package and m{width} which provides a vertical center alignment but that was still different than whatever itemize is using. I'd say just play with the width argument inside of p{} to get the spacing/width you want. If your right column spills on to another line, you may need a "dummy" item in the right column.
Anyway, based on all the jimmy rigging that might be necessary if things spill onto two lines, I'm assuming my solution is potentially hackish but it looks like it provides what you want for the most part.
the \item[] for the right column is to create the same itemize alignment with no bullet. If you want bullets on the right, just remove the empty square brackets and you'll have them.
In beamer frames I want the contents to be spread out evenly across the frame.
Using option \documentclass[slidestop]{beamer} I can easily specify the contents to be top/center aligned but when I have only few bullets on a slide they get clustered together at the top, I want beamer to decide the spacing between them automatically to spread them evenly.
Is this possible without putting vspace by trial and error?
I think using \vfill would reduce the trial and error part. One \vfill between each bullet should guarantee even spacing. Try \vfill before and/or after bullets to get separation from preceding text or from bottom of page. I don't use or know Beamer, but I suspect there's a way to put the \vfill commands into the Beamer template.
\documentclass{article}
\begin{document}
\begin{itemize}
\vfill\item This is text of first item
\vfill\item This is text of second item
\vfill\item This is text of third item
\end{itemize}
\end{document}
Per your comment, here's one way you could define vfill to be automatically used in main list items but have no vfill in subitems. THis way lets you use same \item command regardless of whether you're in main list or in nested list, but requires you to define or redefine environments, and to be aware of when you're adding a main (i.e, vfilled) list and when you're adding a non-vfilled (i.e, nested) list:
\documentclass{article}
\newenvironment{novfillenum}{\begin{enumerate}\let\item\olditem}%
{\end{enumerate}}
\newenvironment{vfilleditems}{\begin{itemize} \let\olditem\item \renewcommand\item{\vfill\olditem}}%
{\end{itemize}}
\begin{document}
\begin{vfilleditems}
\item Item One
\begin{novfillenum}
\item subitem1
\item s2
\item s3
\end{novfillenum}
\item Item Two
\begin{novfillenum}
\item subitem1
\item s2
\item s3
\end{novfillenum}
\item item three
\begin{novfillenum}
\item subitem1
\item s2
\item s3
\end{novfillenum}
\end{vfilleditems}
\end{document}
Adding another sample here because first answer getting too crowded. Tested altering the label commands and, what do you know, it seems to work, sort of. It gives errors, though, which I'm sure are related to having the \vfill as part of the label construct. I'm surprised it does seem to create the desired output, but the method would need some tweaking to get it to work without errors:
\begin{document}
\let\oldlabelitemi\labelitemi
\renewcommand{\labelitemi}{\vfill\oldlabelitemi{\hspace{1ex}}}
\begin{itemize}
\item Item One
\begin{itemize}
\item subone
\item subtwo
\item subthree
\end{itemize}
\item Item Two
\begin{itemize}
\item subitem1
\item s2
\item s3
\end{itemize}
\item item three
\begin{itemize}
\item subitem1
\item s2
\item s3
\end{itemize}
\end{itemize}
\end{document}