General3 Nag warnings with title page. Why ?

LaTeX specific issues not fitting into one of the other forums of this category.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

3 Nag warnings with title page. Why ?

Post by Cham »

Here's another MWE code which gives a Nag warning :
Package nag Warning: table with no \caption on input line 28.
I don't want the table to get any caption! So what is wrong with this code?

Code: Select all

\RequirePackage[l2tabu,orthodox]{nag}
\documentclass[11pt,letterpaper,twoside]{article}
\usepackage[T1]{fontenc}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{tabularx}

\begin{document}

\subsection{Subsection title}

Bla bla

\begin{table}
	\begin{tabularx}{\textwidth}{|X|X|X|}
	\hline
	Name 1 & Name 2 & Name 3
	\\ \hline
	Text & Text & Text
	\\ \hline
	\end{tabularx}
\end{table}  % What is wrong with this table?

Bla bla

\end{document}
Last edited by Cham on Sat Oct 28, 2017 4:54 pm, edited 1 time in total.

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

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

3 Nag warnings with title page. Why ?

Post by Johannes_B »

Nothing. The package assumes that every tabular (defined within table) moves around (it does indeed, as that is the only purpose of a table) and needs a caption to be refernced.

Are you maybe doing \begin{table}[H] in your own document? Do not. Omit the table environment.

A mistake many users make.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

3 Nag warnings with title page. Why ?

Post by Cham »

Johannes_B wrote: Are you maybe doing \begin{table}[H] in your own document? Do not. Omit the table environment.
Yes, I do this. What then to do, and I want all the tables and figures to be fixed on THAT place. I don't want them to move around.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

3 Nag warnings with title page. Why ?

Post by Johannes_B »

Omit the table environment.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

3 Nag warnings with title page. Why ?

Post by Cham »

I can't! For example, I need to do this, which works without any Nag warning :

Code: Select all

\RequirePackage[l2tabu,orthodox]{nag}
\documentclass[11pt,letterpaper,twoside]{article}
\usepackage[T1]{fontenc}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{tabularx}
\usepackage{here}

\begin{document}
 
\subsection{Subsection title}
 
Bla bla
 
\begin{table}[H]
	\centering
	\renewcommand{\arraystretch}{1.5}
	\begin{tabularx}{\textwidth}{|X|X|X|}
	\hline
	Name 1 & Name 2 & Name 3
	\\ \hline
	Text & Text & Text
	\\ \hline
	\end{tabularx}
\end{table}  % WHAT IS WRONG?
 
Bla bla
 
\end{document}
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

3 Nag warnings with title page. Why ?

Post by Johannes_B »

Well then, where is the problem? Use [H] all the time. It does what you want, prevents the figure or table from moving.

It is just more code to type in.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

3 Nag warnings with title page. Why ?

Post by Cham »

I don't see how to make the previous table, without the table environment and the tabularx inside. How would you modify the previous code ?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

3 Nag warnings with title page. Why ?

Post by Johannes_B »

The center environment adds a bit of vertical space. A minipage around would be even better, but again more typing.

Code: Select all

\RequirePackage[l2tabu,orthodox]{nag}
\documentclass[11pt,letterpaper,twoside]{article}
\usepackage[T1]{fontenc}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{tabularx}
\usepackage{here}

\begin{document}

\subsection{Subsection title}

Bla bla

{\centering
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\textwidth}{|X|X|X|}
\hline
Name 1 & Name 2 & Name 3
\\ \hline
Text & Text & Text
\\ \hline
\end{tabularx}}

Bla bla

\begin{center}
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\textwidth}{|X|X|X|}
\hline
Name 1 & Name 2 & Name 3
\\ \hline
Text & Text & Text
\\ \hline
\end{tabularx}
\end{center}

No Wombat in the table above. 
\end{document}
Just stick with using H.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

3 Nag warnings with title page. Why ?

Post by Cham »

Ok, thanks a lot. For the moment, I'll stick with the table environment (with [H]).

But I still have a strange Nag warning with that label inside a list. I don't know what to do, to solve this issue, and I'm yet unable to produce a MWE for this. I'll try something else.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

3 Nag warnings with title page. Why ?

Post by Johannes_B »

Nag is a script, without any intelligence. It might report false warnings.
The manual even tells you so, it can report false things and it might not pick up all bad things.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply