Text FormattingPlacing text with tabs, aligning or with tables without numbering

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Es_dutch
Posts: 8
Joined: Fri Apr 24, 2020 9:35 pm

Placing text with tabs, aligning or with tables without numbering

Post by Es_dutch »

In my document I would like to have the following:
Aantekening 2020-04-25 125348.png
Aantekening 2020-04-25 125348.png (19.22 KiB) Viewed 7551 times
I tried to do it with a table, that worked. But I cannot figure out how to surpress the number of the table for those specific one. Now the next table starts with Table 2. I am planning to add more tables so manually numbering them is not convenient.

Does someone knows how to get the text like the picture using tabs and aligning the text? Or is there a way I can use the tables without making them count in the table list and the numbering of the rest of the tables?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Placing text with tabs, aligning or with tables without numbering

Post by Ijon Tichy »

First of all: You can use a tabular without a table environment and without a \caption. Using caption would provide also captions without numbers. But I would not use a tabular for something like this but a list. Lists support page breaks inside the items. This is mostly better than using, e.g., a longtable that supports page breaks only between table rows and therefore between items.

Such a thing can be done very easily using the labeing environment of KOMA-Script, e.g., provided by package scrextend or every KOMA-Script class:
\documentclass{article}

\usepackage{scrextend}
\usepackage{lipsum}

\begin{document}
\begin{labeling}[~--]{Second}
\item[First] \lipsum[1]
\item[Second] \lipsum[2]
\item[Third] \lipsum[3]
\end{labeling}
\end{document}
But if it should really be something like an enumeration, usage of enumitem would be the better suggestion:
\documentclass{article}

\usepackage{enumitem}
\usepackage{lipsum}
%\usepackage{showframe}% If you need to visualise the text area.

\begin{document}
\begin{enumerate}[label={Hypothesis~\arabic{*}:},labelsep=1em,leftmargin=*]
\item \lipsum[1]
\item \lipsum[2]
\item \lipsum[3]
\end{enumerate}
\end{document}
You can even define a new enumerate list:
\documentclass{article}

\usepackage{enumitem}
\usepackage{lipsum}

\newlist{hypothesis}{enumerate}{1}
\setlist[hypothesis]{label={Hypothesis~\arabic{*}:},labelsep=1em,leftmargin=*}

\begin{document}
\begin{hypothesis}
\item \lipsum[1]
\item \lipsum[2]
\item \lipsum[3]
\end{hypothesis}
\end{document}
See the manuals of the packages (available on your computer or via the links in this post) for more information.
Last edited by Ijon Tichy on Sat Apr 25, 2020 3:04 pm, edited 1 time in total.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Placing text with tabs, aligning or with tables without numbering

Post by Bartman »

You announce a solution with enumitem before the second example, but insert the first example with the labeling environment a second time.

In the third example, the enumeration towers over the left margin. This should be fixed by adding the leftmargin=* option to \setlist.
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Placing text with tabs, aligning or with tables without numbering

Post by Ijon Tichy »

@Bartman Thanks.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Es_dutch
Posts: 8
Joined: Fri Apr 24, 2020 9:35 pm

Placing text with tabs, aligning or with tables without numbering

Post by Es_dutch »

Thank you so much! It works.
How can I change the numbers to 1a 1b 2a 3a 3b 3c, something like that? Is that also possible?
Es_dutch
Posts: 8
Joined: Fri Apr 24, 2020 9:35 pm

Placing text with tabs, aligning or with tables without numbering

Post by Es_dutch »

I already found it! Simply put
\item[1b)]

Thank you for your help, very kind!
Es_dutch
Posts: 8
Joined: Fri Apr 24, 2020 9:35 pm

Placing text with tabs, aligning or with tables without numbering

Post by Es_dutch »

Bartman wrote:You announce a solution with enumitem before the second example, but insert the first example with the labeling environment a second time.

In the third example, the enumeration towers over the left margin. This should be fixed by adding the leftmargin=* option to \setlist.
The enumeration is still slightly outside the margin. I put leftmargin=* in the setlist, however this does not seems to work.
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Placing text with tabs, aligning or with tables without numbering

Post by Bartman »

Create an example that shows the problem.
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Placing text with tabs, aligning or with tables without numbering

Post by Ijon Tichy »

Seems you are doing something different than you've asked. Ask, what you are really intend to do and always add a Infominimal working example. And if you intend to do the labeling of the list yourself instead of automatically, you should try my first solution. And in all cases you should really read the documentation of the environments and commands you are using.

Currently it seem, you are searching for something like:

Code: Select all

\documentclass{article}

\usepackage{lipsum}

\begin{document}
\begin{enumerate}
\item \lipsum[1]
  \begin{enumerate}
  \item \lipsum[2]
  \item \lipsum[2]
  \end{enumerate}
\item \lipsum[3]
  \begin{enumerate}
  \item \lipsum[2]
  \item \lipsum[2]
  \end{enumerate}
\end{enumerate}
\end{document}
or

Code: Select all

\documentclass{article}

\usepackage{enumitem}
\setlist[enumerate,2]{label=\arabic{enumi}\alph{enumii})}
\usepackage{lipsum}

\begin{document}
\begin{enumerate}
\item \lipsum[1]
  \begin{enumerate}
  \item \lipsum[2]
  \item \lipsum[2]
  \end{enumerate}
\item \lipsum[3]
  \begin{enumerate}
  \item \lipsum[2]
  \item \lipsum[2]
  \end{enumerate}
\end{enumerate}
\end{document}
But this is highly speculative for lack of information from you.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Es_dutch
Posts: 8
Joined: Fri Apr 24, 2020 9:35 pm

Placing text with tabs, aligning or with tables without numbering

Post by Es_dutch »

Sorry I am new here, this is my minimal working example. Is this the correct way?
The first picture I posted was how I want it in one chapter. In a following chapter I will split the hypotheses by multiple ones, so 1a, 1b, 1c (without stating the old ones again). Your last example only works when there is an item 1 and thereafter an item 1a 1b. When you delete item one the following items will be 0a 0b etc.

The way I specify it, the listing goes beyond the left margin as you can see in the example.


\documentclass{article}
\usepackage{lipsum}
\usepackage{enumitem}
\newlist{hypothesis}{enumerate}{2}
\setlist[hypothesis]{label={Hypothesis~\arabic{*}:},labelsep=1em,leftmargin=*}
\setlist[enumerate,2]{label=\arabic{enumi}\alph{enumii})}

\begin{document}
\lipsum[1]
\begin{hypothesis}
\item[Hypothesis 3a:] \lipsum[1]
\item[Hypothesis 3b:] \lipsum[2]
\item[Hypothesis 3c:] \lipsum[3]
\end{hypothesis}
\begin{enumerate}
\item \lipsum[1]
\begin{enumerate}
\item \lipsum[2]
\item \lipsum[2]
\end{enumerate}
\item \lipsum[3]
\begin{enumerate}
\item \lipsum[2]
\item \lipsum[2]
\end{enumerate}
\end{enumerate}
\end{document}
Post Reply