Block comments

46 views
Skip to first unread message

Ian Fantom

unread,
Jun 2, 2023, 11:26:20 AM6/2/23
to latexus...@googlegroups.com, Peter Flynn

I'm using block comments to debug some code, using the vertabim package, as in:

\begin{comment}
Commented code
\end{comment}

I have in the commented code a commented out \end{package}, as in:

tackle what is a truly global and indiscriminate
threat'\textsuperscript{{[}18{]}{[}Appendix 2{]}}}
% \end{comment}
\item[2014-09-25:]{David Cameron's speech to the UN General
Assembly\textsuperscript{{[}17{]}{[}Appendix 3{]}}}

In this case the compiler seems to be ignoring the fact that it is commented out. The text above is greyed out, but the text below is not greyed out.

I'm using TexStudio under Ubuntu.

Has anyone else come across such a thing? I've been relying on shifting the commented out areas for the debugging, and got thoroughly confused until I noticed this.

Thanks

Ian Fantom


Peter Flynn

unread,
Jun 2, 2023, 3:49:32 PM6/2/23
to Ian Fantom, latexus...@googlegroups.com
On 02/06/2023 16:25, Ian Fantom wrote:
> I'm using block comments to debug some code, using the verbatim package,
> as in:
>
> |\begin{comment} Commented code \end{comment} I have in the commented
> code a commented out \end{package}, as in: |

What does \end{package} do? Or did you mean \end{comment}?

> tackle what is a truly global and indiscriminate
> threat'\textsuperscript{{[}18{]}{[}Appendix 2{]}}}
> % \end{comment}
> \item[2014-09-25:]{David Cameron's speech to the UN General
> Assembly\textsuperscript{{[}17{]}{[}Appendix 3{]}}}

This isn't really enough to recreate the error, I'm afraid.

\begin{aside)
If those really are bibliographic references, it would be much easier to
use biblatex with the superscript citation method from
https://tex.stackexchange.com/questions/60921/biblatex-supercite-command-with-use-of-square-brackets-like-a-reference-style-i.
Then you can type \cite[Appendix 3]{cameron2011} and forget about all
the \textsuperscript stuff.
\end{aside}

> In this case the compiler seems to be ignoring the fact that it is
> commented out. The text above is greyed out, but the text below is not
> greyed out.

I know that one of the limitations of the original verbatim environment
was that LaTeX detected the end of it NOT by reading the \end command
and then looking to see {verbatim}, but by looking for a whole line
containing ONLY the exact text \end{verbatim}. I assume that this
restriction is removed in the verbatim package, but the authors' note at
the foot of page 1 of their documentation seems to hint that they have
not entirely solved the problem.

It may be that in applying the same techniques to the comment
environment, an embedded, commented-out \end{comment} is failing to be
detected.

Have you tried using the 'comment' package instead?

> I'm using TexStudio under Ubuntu.

That shouldn't make any difference, as it's just a front end for LaTeX.

Peter

Ian Fantom

unread,
Jun 2, 2023, 5:13:20 PM6/2/23
to Peter Flynn, latexus...@googlegroups.com

On 02/06/2023 20:49, Peter Flynn wrote:
> On 02/06/2023 16:25, Ian Fantom wrote:
>> I'm using block comments to debug some code, using the verbatim
>> package, as in:
>>
>> |\begin{comment} Commented code \end{comment} I have in the commented
>> code a commented out \end{package}, as in: |
>
> What does \end{package} do? Or did you mean \end{comment}?
Oops! Yes: \end{comment}
>
>> tackle what is a truly global and indiscriminate
>> threat'\textsuperscript{{[}18{]}{[}Appendix 2{]}}}
>> % \end{comment}
>> \item[2014-09-25:]{David Cameron's speech to the UN General
>> Assembly\textsuperscript{{[}17{]}{[}Appendix 3{]}}}
>
> This isn't really enough to recreate the error, I'm afraid.
I had the same problem - sometimes it worked but occasionally it didn't!
>
> \begin{aside)
> If those really are bibliographic references, it would be much easier
> to use biblatex with the superscript citation method from
> https://tex.stackexchange.com/questions/60921/biblatex-supercite-command-with-use-of-square-brackets-like-a-reference-style-i.
> Then you can type \cite[Appendix 3]{cameron2011} and forget about all
> the \textsuperscript stuff.
> \end{aside}
Ah, thanks. I presumed that using something like biblatex would involve
reinputting all the references, which were already listed in the Writer
document. That seems like a lot of extra effort. The superscripted
numbers are numbers in the reference list, and Appendix relates to the
appendix of the book, where the details are given. The overall listing
is a \begin{description} ... \end{description} list, and is meant to
present a chronological listing of events, with the date standing out to
the left in bold, and the rest indented. When it works, that is exactly
what I'm trying to recreate from the Writer original.

I'll try playing around with that.

>> In this case the compiler seems to be ignoring the fact that it is
>> commented out. The text above is greyed out, but the text below is
>> not greyed out.
>
> I know that one of the limitations of the original verbatim
> environment was that LaTeX detected the end of it NOT by reading the
> \end command and then looking to see {verbatim}, but by looking for a
> whole line containing ONLY the exact text \end{verbatim}. I assume
> that this restriction is removed in the verbatim package, but the
> authors' note at the foot of page 1 of their documentation seems to
> hint that they have not entirely solved the problem.
>
> It may be that in applying the same techniques to the comment
> environment, an embedded, commented-out \end{comment} is failing to be
> detected.
>
> Have you tried using the 'comment' package instead?
Ah! I thought vertabim was the 'comment' package. That's all I found. I
jumped in at the deep end in learning LaTex!
>
>> I'm using TexStudio under Ubuntu.
>
> That shouldn't make any difference, as it's just a front end for LaTeX.
>
> Peter

Thanks,

Ian



Peter Flynn

unread,
Jun 2, 2023, 5:44:41 PM6/2/23
to latexus...@googlegroups.com
On 02/06/2023 22:12, Ian Fantom wrote:
[snip]
> Ah, thanks. I presumed that using something like biblatex would
> involve reinputting all the references, which were already listed in
> the Writer document.

Oh dear. It would certainly mean putting them into a bibliographic
database, which is a bit tedious and not easily automatable. I'm afraid
it's a wordprocessor penalty.

> That seems like a lot of extra effort.

For an ephemeral or unimportant or shortlived document, it's not really
necessary. But for anything with a longer life, especially if it is
going to be re-edited and reformatted from time to time, it's essential
in order to ensure that the format does not deteriorate over time.

How many references are there?

> The superscripted numbers are numbers in the reference list, and
> Appendix relates to the appendix of the book, where the details are
> given. The overall listing is a \begin{description} ...
> \end{description} list, and is meant to present a chronological
> listing of events, with the date standing out to the left in bold,
> and the rest indented. When it works, that is exactly what I'm trying
> to recreate from the Writer original.

Sounds good, and no reason why it shouldn't work.

>> Have you tried using the 'comment' package instead?
> Ah! I thought verbatim was the 'comment' package.

It's a package for improving verbatim. Its use for comments is sideline.

> That's all I found.

Can you say where you searched, that returned you this? Google is not
good for this level of accuracy.

Going to CTAN (https://ctan.org) and searching for a keyword (eg
'comment') will return a list of packages matching the keyword.

> I jumped in at the deep end in learning LaTex!

We all did that :-) Some of us never surfaced...

Peter

Ian Fantom

unread,
Jun 3, 2023, 10:22:13 AM6/3/23
to latexus...@googlegroups.com

On 02/06/2023 22:44, Peter Flynn wrote:
> On 02/06/2023 22:12, Ian Fantom wrote:
> [snip]
>> Ah, thanks. I presumed that using something like biblatex would
>> involve reinputting all the references, which were already listed in
>> the Writer document.
>
> Oh dear. It would certainly mean putting them into a bibliographic
> database, which is a bit tedious and not easily automatable. I'm
> afraid it's a wordprocessor penalty.
>
>> That seems like a lot of extra effort.
>
> For an ephemeral or unimportant or shortlived document, it's not
> really necessary. But for anything with a longer life, especially if
> it is going to be re-edited and reformatted from time to time, it's
> essential in order to ensure that the format does not deteriorate over
> time.
>
> How many references are there?

Something like 60 per chapter. Also, many are journalistic references,
where the name of the journalist is not so important, so the title comes
first, as distinct to the normal scientific formats.

For the moment I'm doing the minimal for  getting the thing to work.
I'll review the other options later.


>
>> The superscripted numbers are numbers in the reference list, and
>> Appendix relates to the appendix of the book, where the details are
>> given. The overall listing is a \begin{description} ...
>> \end{description} list, and is meant to present a chronological
>> listing of events, with the date standing out to the left in bold,
>> and the rest indented. When it works, that is exactly what I'm trying
>> to recreate from the Writer original.
>
> Sounds good, and no reason why it shouldn't work.
>
>>> Have you tried using the 'comment' package instead?
>> Ah! I thought verbatim was the 'comment' package.
>
> It's a package for improving verbatim. Its use for comments is sideline.
>
>> That's all I found.
>
> Can you say where you searched, that returned you this? Google is not
> good for this level of accuracy.

I found verbatim at
https://tex.stackexchange.com/questions/87303/multi-line-block-comments-in-latex

I was surprised at my lack of success in searching for block comments. I
first looked in Firuza Karmali's 'A short introduction to LaTex'.

and Nicola Talbots books 'Latex for complete novices' and 'Using Latex
to write a PhD thesis'.


>
> Going to CTAN (https://ctan.org) and searching for a keyword (eg
> 'comment') will return a list of packages matching the keyword.

Found it, but I don't see how to download and install a package.

Peter Flynn

unread,
Jun 5, 2023, 5:29:54 PM6/5/23
to latexus...@googlegroups.com
On 03/06/2023 11:49, Ian Fantom wrote:
[...]
>> How many references are there?
>
> Something like 60 per chapter. Also, many are journalistic references,
> where the name of the journalist is not so important, so the title comes
> first, as distinct to the normal scientific formats.

Probably much easier to get into processable format, though.

> For the moment I'm doing the minimal for  getting the thing to work.
> I'll review the other options later.

Good move.

>> Can you say where you searched, that returned you this? Google is not
>> good for this level of accuracy.
>
> I found verbatim at
> https://tex.stackexchange.com/questions/87303/multi-line-block-comments-in-latex

Thank you!

> I was surprised at my lack of success in searching for block comments. I
> first looked in Firuza Karmali's 'A short introduction to LaTex'.
> and Nicola Talbots books 'Latex for complete novices' and 'Using Latex
> to write a PhD thesis'.

I've only ever seen it being used twice, I think. But it ought to get a
mention. I'm adding it to FI.

>> Going to CTAN (https://ctan.org) and searching for a keyword (eg
>> 'comment') will return a list of packages matching the keyword.
>
> Found it, but I don't see how to download and install a package.

The download link is on the lower left below the grey summary block,
where it says "Download the contents of this package in one zip archive"

Unzip it into the texmf/tex/latex folder in your personal TeX directory.
(If you don't have one, create it now: details at
http://latex.silmaril.ie/formattinginformation/personal.html)

Peter

Gildas Cotomale

unread,
Jun 6, 2023, 2:51:39 AM6/6/23
to LaTeX Users Group
Peter Flynn wrote:
On 03/06/2023 11:49, Ian Fantom wrote:
[...]
>> Going to CTAN (https://ctan.org) and searching for a keyword (eg
>> 'comment') will return a list of packages matching the keyword.
>
> Found it, but I don't see how to download and install a package.

The download link is on the lower left below the grey summary block,
where it says "Download the contents of this package in one zip archive"

Unzip it into the texmf/tex/latex folder in your personal TeX directory.
(If you don't have one, create it now: details at
http://latex.silmaril.ie/formattinginformation/personal.html)

Also Ian mentionned earlier to use TeXstudio under Ubuntu,
so I guess  he's using TeX Live isn't he? The package page,
has the indication that it's already contained in.
No more installation should be needed then
(or just ensure, with the package manager, that "texlive-full" instead of "texlive-basic" is installed)
To use it, in that case, just add in the preamble: \usepackage{comment}

Regards.

Ian Fantom

unread,
Jun 6, 2023, 7:21:48 AM6/6/23
to latexus...@googlegroups.com

Thanks, Gildas!

You've just answered my next question before I've asked it. I was wondering what is included in the distribution and what is not, so eventually I just declared the package in my code, and it seemed to work!

Perhaps I was using TexLive - I don't remember from installing it, but I'll check (probably next week).

I tried \comment ... \endcomment, but the \endcomment didn't seem to work. But  \begin{comment} ... \end{comment} did.

Presumably if the package hadn't been recognised I'd have got an error message.

Regards,

Ian

--
You received this message because you are subscribed to the Google Groups "LaTeX Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to latexusersgro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/latexusersgroup/6faa1546-1aef-469a-9283-ef99171d3d44n%40googlegroups.com.

Ian Fantom

unread,
Aug 22, 2023, 8:26:06 AM8/22/23
to latexus...@googlegroups.com

I've just come back to this issue - diverted onto other things - and have been still getting incomprehensible error messages when I compile.

I think something was being thrown into confusion by unmatched '{ }' brackets outside the commented areas, because now I've corrected that the errors go. However, I still get two 'bad box' messages: 'Underfull \vbox (badness 6396) has occurred while \output is active []'.

The second is the same except for the number. I'm still struggling to understand what that means, and what I can do about it.

Regards,

Ian

Reply all
Reply to author
Forward
0 new messages