LaTeX forum ⇒ General3 Nag warnings with title page. Why ? Topic is solved

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

3 Nag warnings with title page. Why ?

Postby Cham » Sat Oct 28, 2017 4:48 pm

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?

  1. \RequirePackage[l2tabu,orthodox]{nag}
  2. \documentclass[11pt,letterpaper,twoside]{article}
  3. \usepackage[T1]{fontenc}
  4. \usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
  5. \usepackage{tabularx}
  6.  
  7. \begin{document}
  8.  
  9. \subsection{Subsection title}
  10.  
  11. Bla bla
  12.  
  13. \begin{table}
  14. \begin{tabularx}{\textwidth}{|X|X|X|}
  15. \hline
  16. Name 1 & Name 2 & Name 3
  17. \\ \hline
  18. Text & Text & Text
  19. \\ \hline
  20. \end{tabularx}
  21. \end{table} % What is wrong with this table?
  22.  
  23. Bla bla
  24.  
  25. \end{document}
Last edited by Cham on Sat Oct 28, 2017 4:54 pm, edited 1 time in total.

User avatar
Johannes_B
Site Moderator
Posts: 3600
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sat Oct 28, 2017 4:53 pm

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: 826
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Sat Oct 28, 2017 4:56 pm

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: 3600
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sat Oct 28, 2017 4:57 pm

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: 826
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Sat Oct 28, 2017 5:00 pm

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

  1. \RequirePackage[l2tabu,orthodox]{nag}
  2. \documentclass[11pt,letterpaper,twoside]{article}
  3. \usepackage[T1]{fontenc}
  4. \usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
  5. \usepackage{tabularx}
  6. \usepackage{here}
  7.  
  8. \begin{document}
  9.  
  10. \subsection{Subsection title}
  11.  
  12. Bla bla
  13.  
  14. \begin{table}[H]
  15. \centering
  16. \renewcommand{\arraystretch}{1.5}
  17. \begin{tabularx}{\textwidth}{|X|X|X|}
  18. \hline
  19. Name 1 & Name 2 & Name 3
  20. \\ \hline
  21. Text & Text & Text
  22. \\ \hline
  23. \end{tabularx}
  24. \end{table} % WHAT IS WRONG?
  25.  
  26. Bla bla
  27.  
  28. \end{document}

User avatar
Johannes_B
Site Moderator
Posts: 3600
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sat Oct 28, 2017 5:04 pm

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: 826
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Sat Oct 28, 2017 5:07 pm

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: 3600
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sat Oct 28, 2017 5:24 pm

The center environment adds a bit of vertical space. A minipage around would be even better, but again more typing.
  1. \RequirePackage[l2tabu,orthodox]{nag}
  2. \documentclass[11pt,letterpaper,twoside]{article}
  3. \usepackage[T1]{fontenc}
  4. \usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
  5. \usepackage{tabularx}
  6. \usepackage{here}
  7.  
  8. \begin{document}
  9.  
  10. \subsection{Subsection title}
  11.  
  12. Bla bla
  13.  
  14. {\centering
  15. \renewcommand{\arraystretch}{1.5}
  16. \begin{tabularx}{\textwidth}{|X|X|X|}
  17. \hline
  18. Name 1 & Name 2 & Name 3
  19. \\ \hline
  20. Text & Text & Text
  21. \\ \hline
  22. \end{tabularx}}
  23.  
  24. Bla bla
  25.  
  26. \begin{center}
  27. \renewcommand{\arraystretch}{1.5}
  28. \begin{tabularx}{\textwidth}{|X|X|X|}
  29. \hline
  30. Name 1 & Name 2 & Name 3
  31. \\ \hline
  32. Text & Text & Text
  33. \\ \hline
  34. \end{tabularx}
  35. \end{center}
  36.  
  37. No Wombat in the table above.
  38. \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: 826
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Sat Oct 28, 2017 5:32 pm

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: 3600
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sat Oct 28, 2017 5:47 pm

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.


Return to “General”

Who is online

Users browsing this forum: No registered users and 5 guests