In TeX, how do I define the label style for compactenum globally? - latex

I have a couple of compactenum elements in my document. I would like define color and type for all labels in a more elegant way than this:
\begin{compactenum}[label=\textcolor{black}{\arabic*.}]
\item lorem
\item ipsum
\item dolor
\end{compactenum}
\begin{compactenum}[label=\textcolor{black}{\arabic*.}]
\item sit
\item amet
\end{compactenum}
How do I set it globally the most elegant way? Is there a way where I can define the behavior for compactenum without using [...] at all?

What you need is \setdefaultenum{\color{black} 1.}{}{}{}. It will set your outer label to be black arabic label. For more information, refer to paralist documentation Here's a MCVE:
\documentclass{article}
\usepackage{paralist,xcolor}
\setdefaultenum{\color{black} 1.}{}{}{}% What you need!
% The 1. is the equivalent of \arabic*.
% The other {}{}{} refer to the list levels,
% i.e. {second level}{third level}{fourth level}
\begin{document}
\begin{compactenum}
\item lorem
\item ipsum
\item dolor
\end{compactenum}
\end{document}

Related

citation, tables and equation exceed page width in beamer

I am using Latex for the first time and I am preparing a slide using 'beamer'. What happening is that some of my citations, tables and long equations are exceeding beyond the text width, though it wasn't the problem when the document class was 'article'. My tables aren't long, as one of them has only 3 rows and 6 columns.
The latex codes are
\documentclass[9pt]{beamer}
\mode<presentation> {
\usefonttheme{serif}
\usetheme{Madrid}
\definecolor{BlueGreen}{cmyk}{0.85,0,0.33,0}
\colorlet{beamer#blendedblue}{BlueGreen!120}}
\usepackage{booktabs}
\usepackage{caption}
\hypersetup{pdfnewwindow}
\setbeamertemplate{caption}[numbered]
\setbeamerfont{frametitle}{size=\footnotesize}
\setbeamertemplate{navigation symbols}{}
\setbeamercolor{postit}{bg=violet!110}
\usepackage{ragged2e} %new code
\addtobeamertemplate{block begin}{}{\justifying}
\usepackage{textpos}
\begin{document}
\begin{frame} \frametitle{\textbf{{\Large Objective}}}
\begin{itemize}
\justifying
\item This package gives you easy access to the Lorem Ipsum dummy text; an option is available to separate the paragraphs of the dummy text. This text \cite{kumar2015method}.
\item The long equation is:
\begin{equation}
A(\theta,\alpha) = \dfrac{ A*{-(\alpha*A)}\beta*{(\delta-1)} \left(A* \hspace{1mm}\hspace{1mm}C^{-A Z_{H}} \hspace{1mm}C^{-C^{-A *Z_{H}}} \prod_{i=1}^{m-1} \left( \dfrac{ A \hspace{1mm}C^{-A* Z_{u(i)}} C^{-C^{-A* Z_{u(i)}}}}{1- \frac{1}{C-1} (C^{1-C^{-A Z_{u(i)}}}-1)}\right) \right) }{ \int_{0}^{\infty} C^{-(\alpha *A)}(A^{(\beta-1)} \left( A* \hspace{1mm}\hspace{1mm}C^{-A Z_{H}} \hspace{1mm}C^{-C^{-A Z_{H}}} \prod_{i=1}^{B-1} \left(\dfrac{ A \hspace{1mm}C^{-A Z_{u(i)}} C^{-C^{-A* Z_{u(i)}}}}{1- \frac{1}{C-1} (C^{1-C^{-A* Z_{u(i)}}}-1)}\right) \right) A} .
\end{equation}
\end{itemize}
\end{frame}
\bibliography{ref}
\bibliographystyle{plainnat}
\end{document}
And the contents of the .bib file is:
#article{kumar2015method,
title={This is the title of the article},
author={Kumar, Dinesh and others},
journal={This is Journal},
volume={2},
number={3},
pages={150-180},
year={2015}
}
If you use the plainnat bib style, you should also load the natbib package. This will automatically allow line breaks
you don't need the caption package, beamer provides it's own mechanism to customise captions
you must place the bibliography inside a frame
for the very large equation, I would suggest to replace the fraction with (...) \times (...)^{-1}, this way you can split it over multiple lines. In addition you'll probably want to use a smaller font size and maybe remove all the manual spaces.
\documentclass[9pt]{beamer}
\mode<presentation> {
\usefonttheme{serif}
\usetheme{Madrid}
\definecolor{BlueGreen}{cmyk}{0.85,0,0.33,0}
\makeatletter
\colorlet{beamer#blendedblue}{BlueGreen!120}
\makeatother
}
\usepackage{booktabs}
%\usepackage{caption}
\hypersetup{pdfnewwindow}
\setbeamertemplate{caption}[numbered]
\setbeamerfont{frametitle}{size=\footnotesize}
\setbeamertemplate{navigation symbols}{}
\setbeamercolor{postit}{bg=violet!110}
\usepackage{ragged2e} %new code
\addtobeamertemplate{block begin}{}{\justifying}
\usepackage{natbib}
\usepackage{textpos}
\begin{document}
\begin{frame} \frametitle{\textbf{{\Large Objective}}}
\begin{itemize}
\justifying
\item This package gives you easy access to the Lorem Ipsum dummy text; an option is available to separate the paragraphs of the dummy text. This text \cite{kumar2015method}.
\item The long equation is:
\end{itemize}
\end{frame}
\begin{frame}
\bibliography{ref}
\bibliographystyle{plainnat}
\end{frame}
\end{document}

Itemized / Enumarte List structure in LaTeX

I was wondering, if there is any way to have an enumeration using LaTeX to have something like:
1. (a) Some text, some text
(b) Some more text
2. (a) Yet some more text
(b) Something more ...
Please note that I can very well have
1. Somethig here ...
(a) Some text
(b) Some more text
2. Another text
(a) Something here ...
(b) Etc. etc.
What you show is simply the default behaviour of enumerate:
\documentclass{article}
\begin{document}
\begin{enumerate}
\item
\begin{enumerate}
\item test
\item test
\end{enumerate}
\item
\begin{enumerate}
\item test
\item test
\end{enumerate}
\end{enumerate}
\end{document}

Text exceed from cover page, how to solve it?

I have brought the title, which is a bit long sentence in cover page.
However, it exceeds the page width, how to correct it? Thanks
\vspace{30mm} \centerline{{\bf Title BLAH Blah}}
You could try using the center environment, as it allows natural wrapping at within the text block:
\begin{center}
\bfseries
Lorem ipsum dolor sit amet, consectetur adipiscing elit \ldots
\end{center}
Note the use of \bfseries rather than \bf:
Does it matter if I use \textit or \it, \bfseries or \bf, etc
Will two-letter font style commands (\bf , \it , …) ever be resurrected in LaTeX?

align-like environment in LaTeX for lines of texts

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.

Latex Remove Spaces Between Items in List

What is the best way to format a list as to remove the spaces between list items.
It's easier with the enumitem package:
\documentclass{article}
\usepackage{enumitem}
\begin{document}
Less space:
\begin{itemize}[noitemsep]
\item foo
\item bar
\item baz
\end{itemize}
Even more compact:
\begin{itemize}[noitemsep,nolistsep]
\item foo
\item bar
\item baz
\end{itemize}
\end{document}
The enumitem package provides a lot of features to customize bullets, numbering and lengths.
The paralist package provides very compact lists: compactitem, compactenum and even lists within paragraphs like inparaenum and inparaitem.
You could do something like this:
\documentclass{article}
\begin{document}
Normal:
\begin{itemize}
\item foo
\item bar
\item baz
\end{itemize}
Less space:
\begin{itemize}
\setlength{\itemsep}{1pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
\item foo
\item bar
\item baz
\end{itemize}
\end{document}
This question was already asked on https://tex.stackexchange.com/questions/10684/vertical-space-in-lists. The highest voted answer also mentioned the enumitem package (here answered by Stefan), but I also like this one, which involves creating your own itemizing environment instead of loading a new package:
\newenvironment{myitemize}
{ \begin{itemize}
\setlength{\itemsep}{0pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt} }
{ \end{itemize} }
Which should be used like this:
\begin{myitemize}
\item one
\item two
\item three
\end{myitemize}
Source: https://tex.stackexchange.com/a/136050/12065
compactitem does the job.
\usepackage{paralist}
...
\begin{compactitem}[$\bullet$]
\item Element 1
\item Element 2
\end{compactitem}
\vspace{\baselineskip} % new line after list

Resources