0

This is the code where I got the warning message. However, when I put {} to the command such as \endhead{}, the warning goes away. However I get errors for misplaced noalign.

\begin{center}
    \begin{longtable}{>{\raggedright\arraybackslash}p{0.15\linewidth} >{\raggedright\arraybackslash}p{0.2\linewidth} >{\raggedright\arraybackslash}p{0.15\linewidth} >{\raggedright\arraybackslash}p{0.12\linewidth} >{\raggedright\arraybackslash}p{0.12\linewidth}}
        \caption{Differences of things{\label{tab:diff}}} \\
        \toprule
        \multicolumn{1}{c}{Things} &
        \multicolumn{1}{c}{Purpose} &
        \multicolumn{1}{c}{Steps} &
        \multicolumn{1}{c}{Materials} &
        \multicolumn{1}{c}{Description} \\
        \midrule
        \endfirsthead % <-- Command terminated with space
        \caption{(Continued){\label{tab:diff}}} \\
        \toprule
         \multicolumn{1}{c}{Things} &
        \multicolumn{1}{c}{Purpose} &
        \multicolumn{1}{c}{Steps} &
        \multicolumn{1}{c}{Materials} &
        \multicolumn{1}{c}{Description} \\
        \midrule
        \endhead % <-- Command terminated with space
        AAAAAAAAAAAA &
        BBBBBBBBBBBB &
        CCCCCCCCCCCCC &
        DDDDDDDDDDD &
        EEEEEEEEEEEEEE \\
        \midrule
        AAAAAAAAAAAA &
        BBBBBBBBBBBB &
        CCCCCCCCCCCCC &
        DDDDDDDDDDD &
        EEEEEEEEEEEEEE \\
        \midrule
        AAAAAAAAAAAA &
        BBBBBBBBBBBB &
        CCCCCCCCCCCCC &
        DDDDDDDDDDD &
        EEEEEEEEEEEEEE \\
        \bottomrule
    \end{longtable}
\end{center}
6
  • Welcome to TSE. Please post a Minimal Working Example, instead of a code snippet. Sep 15, 2021 at 14:10
  • the space after those commands is correct conversely putting longtable in center is wrong, did chktex not complain about that? chktex is not actually using tex so it is just making a best guess at what is good and what is bad, if you find it helps then fune but if you find it giving spurious warnings then don't use it. Personally I would rather just use latex and get the warnings from that. Sep 15, 2021 at 14:11
  • @JoséCarlosSantos thanks for the welcome. Ill make sure to do that next time.
    – riazufila
    Sep 15, 2021 at 14:42
  • @DavidCarlisle I'm new to latex and I just found some people in this site that does enclose longtable with center. So I thought that was acceptable due to me not getting any errors or warnings upon exporting to pdf. I just tried removing center from longtable and it still works as intended tho. But I wonder why?
    – riazufila
    Sep 15, 2021 at 14:43
  • center does not affect the horizontal position of longtable at all as the construct always spans the full width already so it can break over a page. So all center does is adds spurious vertical space. If you saw examples doing that, they were wrong, it happens:-) Sep 15, 2021 at 15:04

1 Answer 1

1

The chktex documentation defines the warning as

You tried to terminate a command with a blank space. Usually, this is an error as these are ignored by LaTeX. In most cases, you would like to have a real space there.

You can usually ignore the warning, but you can supress it with % chktex 1 at the end of the line.

If you don't want this warning to appear ever with a command you use often, you can edit the chktexrc file in you TeX installation (this is better explained in the documentation).

This warning is displayed because spacing after the command does not produce spacing in the text, so if you use \LaTeX some text, it will appear as LaTeXsome text. If you use \LaTeX\ some text or \LaTeX{} it will avoid this problem, but in your case it will produce an error, so it is best to just ignore it.

2
  • Thank you! This removed the annoying warning :)
    – riazufila
    Sep 15, 2021 at 14:44
  • As with all ChkTeX warnings, if it doesn't help you catch problems you actually make, I suggest turning it off in chktexrc. Sep 17, 2021 at 14:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .