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}
Related
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
I am trying the write something below in latex and what I am trying seems not working well.
\documentclass[10pt,english,8pt]{beamer}
\usepackage{amsmath}
\begin{document}
\begin{frame}
\begin{itemize}
\item Observation equation:
$\begin{pmatrix}
PD_{s,t}\\
RR_{s,t}
\end{pmatrix} = \binom(\gamma_{1}\gamma_{2}) = bla
\end{itemize}
\end{frame}
\end{document}
The syntax \binom(...) is wrong. \binom is a macro with two mandatory arguments, so you need to write \binom{...}{...}.
Some other comments:
the closing $ is missing
personally I would use the pmatrix in both cases to get a more uniform result
combining the 10pt and 8pt class options makes not much sense, they are mutually exclusive. Decide which of the two options you want and then use only this option, not both
you don't need to load amsmath, beamer loads it automatically
\documentclass[english,8pt]{beamer}
\begin{document}
\begin{frame}
\begin{itemize}
\item Observation equation:
$\begin{pmatrix}
PD_{s,t}\\
RR_{s,t}
\end{pmatrix} = \binom{\gamma_{1}}{\gamma_{2}} = bla
$
\end{itemize}
\end{frame}
\end{document}
I want to make a \newline after the \item[L1] to make it seem like a header to the picture and not on the bottom left side. Help?
\section{Labbuppgifter}
\begin{itemize}
\item[L1]
\includegraphics[width = 0.6\linewidth]{L1.jpg}
\end{itemize}
\end{document}
Use \mbox{} to set a blank entry for \item[L1], followed by a paragraph break (an empty line) and then you can set your image.
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\section{A section}
\begin{itemize}
\item[L1] \mbox{}
\includegraphics[width = 0.6\linewidth]{example-image}
\end{itemize}
\end{document}
Of course, there are multiple other ways of achieving this. More detail in the question might provide more specific solutions.
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].
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}