Multi-line (block) comments in LaTeX The 2019 Stack Overflow Developer Survey Results Are InIs...
Write faster on AT24C32
Origin of "cooter" meaning "vagina"
How are circuits which use complex ICs normally simulated?
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
Identify This Plant (Flower)
What is the most effective way of iterating a std::vector and why?
Where to refill my bottle in India?
Why can Shazam fly?
Return to UK after being refused entry years previously
Apparent duplicates between Haynes service instructions and MOT
What does "fetching by region is not available for SAM files" means?
Right tool to dig six foot holes?
How to support a colleague who finds meetings extremely tiring?
Am I thawing this London Broil safely?
Earliest use of the term "Galois extension"?
Why did Acorn's A3000 have red function keys?
Do these rules for Critical Successes and Critical Failures seem Fair?
What do the Banks children have against barley water?
What does ひと匙 mean in this manga and has it been used colloquially?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
Delete all lines which don't have n characters before delimiter
What does Linus Torvalds mean when he says that Git "never ever" tracks a file?
Is there any way to tell whether the shot is going to hit you or not?
Resizing object distorts it (Illustrator CC 2018)
Multi-line (block) comments in LaTeX
The 2019 Stack Overflow Developer Survey Results Are InIs there an easy way to comment out a whole block?Commenting out large sectionsContest: Show Off Your Skillz in TeX & Friends [TeX.sx birthday]LuaLaTeX — Attempt to index global 'luatexbase'LaTeX Listings Package, No Line Number for CommentsComments in BibTexBlock comments with *% and %*Is there an easy way to comment out a whole block?texcl, escapeinside, and single character comments, with listings packageBest practice for writing comments in LaTeX documentsProperly indent comments with no line-numbering in algorithmicxNested block comments?Commenting a single line comments the whole blockIs there a way to toggle comments?
In LaTeX, % can be used for single-line comments. For multi-line comments, the following command is available in the verbatim package.
begin{comment}
Commented code
end{comment}
But is there a simple command like /* code */ in C?
comments
add a comment |
In LaTeX, % can be used for single-line comments. For multi-line comments, the following command is available in the verbatim package.
begin{comment}
Commented code
end{comment}
But is there a simple command like /* code */ in C?
comments
3
Related/duplicate: Commenting out large sections
– Qrrbrbirlbel
Dec 18 '12 at 7:22
3
Also see: Block comments in TeX
– Aditya
Dec 18 '12 at 8:03
Your question was pretty enough for me.
– Joker 00
Apr 27 '17 at 23:12
add a comment |
In LaTeX, % can be used for single-line comments. For multi-line comments, the following command is available in the verbatim package.
begin{comment}
Commented code
end{comment}
But is there a simple command like /* code */ in C?
comments
In LaTeX, % can be used for single-line comments. For multi-line comments, the following command is available in the verbatim package.
begin{comment}
Commented code
end{comment}
But is there a simple command like /* code */ in C?
comments
comments
edited Dec 22 '12 at 19:04
Werner
450k729981707
450k729981707
asked Dec 17 '12 at 5:02
Arindam PalArindam Pal
1,1462810
1,1462810
3
Related/duplicate: Commenting out large sections
– Qrrbrbirlbel
Dec 18 '12 at 7:22
3
Also see: Block comments in TeX
– Aditya
Dec 18 '12 at 8:03
Your question was pretty enough for me.
– Joker 00
Apr 27 '17 at 23:12
add a comment |
3
Related/duplicate: Commenting out large sections
– Qrrbrbirlbel
Dec 18 '12 at 7:22
3
Also see: Block comments in TeX
– Aditya
Dec 18 '12 at 8:03
Your question was pretty enough for me.
– Joker 00
Apr 27 '17 at 23:12
3
3
Related/duplicate: Commenting out large sections
– Qrrbrbirlbel
Dec 18 '12 at 7:22
Related/duplicate: Commenting out large sections
– Qrrbrbirlbel
Dec 18 '12 at 7:22
3
3
Also see: Block comments in TeX
– Aditya
Dec 18 '12 at 8:03
Also see: Block comments in TeX
– Aditya
Dec 18 '12 at 8:03
Your question was pretty enough for me.
– Joker 00
Apr 27 '17 at 23:12
Your question was pretty enough for me.
– Joker 00
Apr 27 '17 at 23:12
add a comment |
6 Answers
6
active
oldest
votes
Following the C code paradigm, where one can use the preprocessor directives
#if 0
junk code
#endif
something similar can be done in TeX (and descendants):
iffalse
I don't want this to happen
fi
The commented parts can be easily activated by replacing iffalse with iftrue.
17
See the TeX FAQ on whyiffalsecan fail in unexpected ways.
– Aditya
Dec 18 '12 at 8:04
@Aditya: thanks for the link, I wasn't aware of these problems!
– guillem
Dec 18 '12 at 8:35
2
@Aditya What would you say is a good and stable way to comment things out? Say, stable in so far as I am not doing anything fancy ---- just commenting out a chunk of code in its plain version. I have also got trouble with block-comment using thebegin{comment}environment, either from theverbatimpackage orcommentspackage.
– llinfeng
Nov 29 '17 at 12:01
add a comment |
No, but you can define something close:
documentclass{article}
begin{document}
longdef/*#1*/{}
AAA
/* This is a test
and this is another
*/
BBB
end{document}
1
Can you make* multiline comments *?
– kiss my armpit
Dec 17 '12 at 7:01
2
@GarbageCollector You can but then it means changing the catcode of the backtick to make it active and would cause a lot of grief in other areas. Ah! did not see your edit ... changing catcode of slash will give you same headaches.
– Yiannis Lazarides
Dec 17 '12 at 7:03
@YiannisLazarides: Of course, this definition cannot be nested. With LuaTeX it is possible to have multiline comments without any catcode jugglery. See Block comments in TeX for an example.
– Aditya
Dec 18 '12 at 8:06
It redefines*and requires a space after the closing delimiter but,def*#1* {}works I think.
– Scott H.
Dec 22 '12 at 21:05
Just a heads-up, this brokeurl{}in BibTex for me. (Sadly)
– domenukk
Nov 29 '16 at 16:10
|
show 1 more comment
Here's a poor man's version of the answer linked by Aditya above. It doesn't require ConTeXt but it does need to be compiled with LuaTeX. With it you can use C style comments: /*comment*/. A potential downside is that it "works" even in a verbatim environment. It works in all situations I can think of.
This input:

Gives this output:

documentclass{article}
usepackage{luacode}
begin{luacode*}
commenting = false
local gsub = string.gsub
local opencomm = "%/%*(.*)"
local closecomm = "(.-)%*%/"
function comment(s)
if not commenting then
s = gsub(s,opencomm,
function(s1)
commenting = true
s1 = gsub(s1,closecomm,function(s2) commenting = false return "" end,1)
if commenting then return "" else
return comment(s1)
end
end
)
else
s = gsub(s,"(.+)",
function(s3)
s3 = gsub(s,closecomm,function(s4) commenting = false return "" end,1)
if commenting then return "%" else
return comment(s3)
end
end
)
end
return s
end
luatexbase.add_to_callback('process_input_buffer', comment, 'comment')
end{luacode*}
begin{document}
1 /*HIDDEN*/ 2
1 /*HIDDEN
HIDDEN*/ 2
1/*HIDDEN
HIDDEN
HIDDEN*/2
1 /*HIDDEN
HIDDEN*/ 2 /*HIDDEN*/ 3
1 /*HIDDEN*/ 2 /*HIDDEN
HIDDEN*/ 3
end{document}
add a comment |
I think the most straightforward way to do this is to use a TeX editor. TeXnicCenter for instance offers to comment and uncomment marked blocks by ctrl+q and ctrl+w. This simply adds a '%' at the respective lines. This further grays out commented section, which is not the case with scripted solutions.
2
you can't have inline comments as such for example2 /* HIDDEN HIDDEN HIDDEN */ 3
– percusse
Nov 27 '13 at 21:18
1
This is true of course. A scripted version also lets hide/show comments by a simple compile flag, which can be great in drafting or reviewing work.
– Thomas Ortner
Nov 27 '13 at 21:46
add a comment |
Short: put directlua{-- before the block and a single } after the block when compiling with Lua(La)TeX.
Long: this is a "bug" of LuaTeX turned into a feature, or what make programmers happy. Putting a double hyphen in front of a text in Lua means a single-line comment; however, since TeX strips newlines from Lua code, this appears as a single-line chunk to Lua and so all the chunk gets commented.
Not tested, but I think you could alias that as
newcommand{multlinecomment}[1]{directlua{-- #1}}
and then enclose your comment as in
multlinecomment{
My multiline
comment
with Lorem ipsum.
}
add a comment |
A simple solution I use is
newcommand{comment}[1]{}
Which just defines a command that does nothing with the input (effectively commenting it out!)
Sample use:
comment{
This line of text won't show
This one won't either
}
add a comment |
protected by Community♦ Jul 5 '15 at 16:24
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
Following the C code paradigm, where one can use the preprocessor directives
#if 0
junk code
#endif
something similar can be done in TeX (and descendants):
iffalse
I don't want this to happen
fi
The commented parts can be easily activated by replacing iffalse with iftrue.
17
See the TeX FAQ on whyiffalsecan fail in unexpected ways.
– Aditya
Dec 18 '12 at 8:04
@Aditya: thanks for the link, I wasn't aware of these problems!
– guillem
Dec 18 '12 at 8:35
2
@Aditya What would you say is a good and stable way to comment things out? Say, stable in so far as I am not doing anything fancy ---- just commenting out a chunk of code in its plain version. I have also got trouble with block-comment using thebegin{comment}environment, either from theverbatimpackage orcommentspackage.
– llinfeng
Nov 29 '17 at 12:01
add a comment |
Following the C code paradigm, where one can use the preprocessor directives
#if 0
junk code
#endif
something similar can be done in TeX (and descendants):
iffalse
I don't want this to happen
fi
The commented parts can be easily activated by replacing iffalse with iftrue.
17
See the TeX FAQ on whyiffalsecan fail in unexpected ways.
– Aditya
Dec 18 '12 at 8:04
@Aditya: thanks for the link, I wasn't aware of these problems!
– guillem
Dec 18 '12 at 8:35
2
@Aditya What would you say is a good and stable way to comment things out? Say, stable in so far as I am not doing anything fancy ---- just commenting out a chunk of code in its plain version. I have also got trouble with block-comment using thebegin{comment}environment, either from theverbatimpackage orcommentspackage.
– llinfeng
Nov 29 '17 at 12:01
add a comment |
Following the C code paradigm, where one can use the preprocessor directives
#if 0
junk code
#endif
something similar can be done in TeX (and descendants):
iffalse
I don't want this to happen
fi
The commented parts can be easily activated by replacing iffalse with iftrue.
Following the C code paradigm, where one can use the preprocessor directives
#if 0
junk code
#endif
something similar can be done in TeX (and descendants):
iffalse
I don't want this to happen
fi
The commented parts can be easily activated by replacing iffalse with iftrue.
edited Dec 18 '12 at 6:52
doncherry
35.3k23137209
35.3k23137209
answered Dec 18 '12 at 6:31
guillemguillem
3,23411214
3,23411214
17
See the TeX FAQ on whyiffalsecan fail in unexpected ways.
– Aditya
Dec 18 '12 at 8:04
@Aditya: thanks for the link, I wasn't aware of these problems!
– guillem
Dec 18 '12 at 8:35
2
@Aditya What would you say is a good and stable way to comment things out? Say, stable in so far as I am not doing anything fancy ---- just commenting out a chunk of code in its plain version. I have also got trouble with block-comment using thebegin{comment}environment, either from theverbatimpackage orcommentspackage.
– llinfeng
Nov 29 '17 at 12:01
add a comment |
17
See the TeX FAQ on whyiffalsecan fail in unexpected ways.
– Aditya
Dec 18 '12 at 8:04
@Aditya: thanks for the link, I wasn't aware of these problems!
– guillem
Dec 18 '12 at 8:35
2
@Aditya What would you say is a good and stable way to comment things out? Say, stable in so far as I am not doing anything fancy ---- just commenting out a chunk of code in its plain version. I have also got trouble with block-comment using thebegin{comment}environment, either from theverbatimpackage orcommentspackage.
– llinfeng
Nov 29 '17 at 12:01
17
17
See the TeX FAQ on why
iffalse can fail in unexpected ways.– Aditya
Dec 18 '12 at 8:04
See the TeX FAQ on why
iffalse can fail in unexpected ways.– Aditya
Dec 18 '12 at 8:04
@Aditya: thanks for the link, I wasn't aware of these problems!
– guillem
Dec 18 '12 at 8:35
@Aditya: thanks for the link, I wasn't aware of these problems!
– guillem
Dec 18 '12 at 8:35
2
2
@Aditya What would you say is a good and stable way to comment things out? Say, stable in so far as I am not doing anything fancy ---- just commenting out a chunk of code in its plain version. I have also got trouble with block-comment using the
begin{comment} environment, either from the verbatim package or comments package.– llinfeng
Nov 29 '17 at 12:01
@Aditya What would you say is a good and stable way to comment things out? Say, stable in so far as I am not doing anything fancy ---- just commenting out a chunk of code in its plain version. I have also got trouble with block-comment using the
begin{comment} environment, either from the verbatim package or comments package.– llinfeng
Nov 29 '17 at 12:01
add a comment |
No, but you can define something close:
documentclass{article}
begin{document}
longdef/*#1*/{}
AAA
/* This is a test
and this is another
*/
BBB
end{document}
1
Can you make* multiline comments *?
– kiss my armpit
Dec 17 '12 at 7:01
2
@GarbageCollector You can but then it means changing the catcode of the backtick to make it active and would cause a lot of grief in other areas. Ah! did not see your edit ... changing catcode of slash will give you same headaches.
– Yiannis Lazarides
Dec 17 '12 at 7:03
@YiannisLazarides: Of course, this definition cannot be nested. With LuaTeX it is possible to have multiline comments without any catcode jugglery. See Block comments in TeX for an example.
– Aditya
Dec 18 '12 at 8:06
It redefines*and requires a space after the closing delimiter but,def*#1* {}works I think.
– Scott H.
Dec 22 '12 at 21:05
Just a heads-up, this brokeurl{}in BibTex for me. (Sadly)
– domenukk
Nov 29 '16 at 16:10
|
show 1 more comment
No, but you can define something close:
documentclass{article}
begin{document}
longdef/*#1*/{}
AAA
/* This is a test
and this is another
*/
BBB
end{document}
1
Can you make* multiline comments *?
– kiss my armpit
Dec 17 '12 at 7:01
2
@GarbageCollector You can but then it means changing the catcode of the backtick to make it active and would cause a lot of grief in other areas. Ah! did not see your edit ... changing catcode of slash will give you same headaches.
– Yiannis Lazarides
Dec 17 '12 at 7:03
@YiannisLazarides: Of course, this definition cannot be nested. With LuaTeX it is possible to have multiline comments without any catcode jugglery. See Block comments in TeX for an example.
– Aditya
Dec 18 '12 at 8:06
It redefines*and requires a space after the closing delimiter but,def*#1* {}works I think.
– Scott H.
Dec 22 '12 at 21:05
Just a heads-up, this brokeurl{}in BibTex for me. (Sadly)
– domenukk
Nov 29 '16 at 16:10
|
show 1 more comment
No, but you can define something close:
documentclass{article}
begin{document}
longdef/*#1*/{}
AAA
/* This is a test
and this is another
*/
BBB
end{document}
No, but you can define something close:
documentclass{article}
begin{document}
longdef/*#1*/{}
AAA
/* This is a test
and this is another
*/
BBB
end{document}
answered Dec 17 '12 at 5:26
Yiannis LazaridesYiannis Lazarides
92.8k21235515
92.8k21235515
1
Can you make* multiline comments *?
– kiss my armpit
Dec 17 '12 at 7:01
2
@GarbageCollector You can but then it means changing the catcode of the backtick to make it active and would cause a lot of grief in other areas. Ah! did not see your edit ... changing catcode of slash will give you same headaches.
– Yiannis Lazarides
Dec 17 '12 at 7:03
@YiannisLazarides: Of course, this definition cannot be nested. With LuaTeX it is possible to have multiline comments without any catcode jugglery. See Block comments in TeX for an example.
– Aditya
Dec 18 '12 at 8:06
It redefines*and requires a space after the closing delimiter but,def*#1* {}works I think.
– Scott H.
Dec 22 '12 at 21:05
Just a heads-up, this brokeurl{}in BibTex for me. (Sadly)
– domenukk
Nov 29 '16 at 16:10
|
show 1 more comment
1
Can you make* multiline comments *?
– kiss my armpit
Dec 17 '12 at 7:01
2
@GarbageCollector You can but then it means changing the catcode of the backtick to make it active and would cause a lot of grief in other areas. Ah! did not see your edit ... changing catcode of slash will give you same headaches.
– Yiannis Lazarides
Dec 17 '12 at 7:03
@YiannisLazarides: Of course, this definition cannot be nested. With LuaTeX it is possible to have multiline comments without any catcode jugglery. See Block comments in TeX for an example.
– Aditya
Dec 18 '12 at 8:06
It redefines*and requires a space after the closing delimiter but,def*#1* {}works I think.
– Scott H.
Dec 22 '12 at 21:05
Just a heads-up, this brokeurl{}in BibTex for me. (Sadly)
– domenukk
Nov 29 '16 at 16:10
1
1
Can you make
* multiline comments * ?– kiss my armpit
Dec 17 '12 at 7:01
Can you make
* multiline comments * ?– kiss my armpit
Dec 17 '12 at 7:01
2
2
@GarbageCollector You can but then it means changing the catcode of the backtick to make it active and would cause a lot of grief in other areas. Ah! did not see your edit ... changing catcode of slash will give you same headaches.
– Yiannis Lazarides
Dec 17 '12 at 7:03
@GarbageCollector You can but then it means changing the catcode of the backtick to make it active and would cause a lot of grief in other areas. Ah! did not see your edit ... changing catcode of slash will give you same headaches.
– Yiannis Lazarides
Dec 17 '12 at 7:03
@YiannisLazarides: Of course, this definition cannot be nested. With LuaTeX it is possible to have multiline comments without any catcode jugglery. See Block comments in TeX for an example.
– Aditya
Dec 18 '12 at 8:06
@YiannisLazarides: Of course, this definition cannot be nested. With LuaTeX it is possible to have multiline comments without any catcode jugglery. See Block comments in TeX for an example.
– Aditya
Dec 18 '12 at 8:06
It redefines
* and requires a space after the closing delimiter but, def*#1* {} works I think.– Scott H.
Dec 22 '12 at 21:05
It redefines
* and requires a space after the closing delimiter but, def*#1* {} works I think.– Scott H.
Dec 22 '12 at 21:05
Just a heads-up, this broke
url{} in BibTex for me. (Sadly)– domenukk
Nov 29 '16 at 16:10
Just a heads-up, this broke
url{} in BibTex for me. (Sadly)– domenukk
Nov 29 '16 at 16:10
|
show 1 more comment
Here's a poor man's version of the answer linked by Aditya above. It doesn't require ConTeXt but it does need to be compiled with LuaTeX. With it you can use C style comments: /*comment*/. A potential downside is that it "works" even in a verbatim environment. It works in all situations I can think of.
This input:

Gives this output:

documentclass{article}
usepackage{luacode}
begin{luacode*}
commenting = false
local gsub = string.gsub
local opencomm = "%/%*(.*)"
local closecomm = "(.-)%*%/"
function comment(s)
if not commenting then
s = gsub(s,opencomm,
function(s1)
commenting = true
s1 = gsub(s1,closecomm,function(s2) commenting = false return "" end,1)
if commenting then return "" else
return comment(s1)
end
end
)
else
s = gsub(s,"(.+)",
function(s3)
s3 = gsub(s,closecomm,function(s4) commenting = false return "" end,1)
if commenting then return "%" else
return comment(s3)
end
end
)
end
return s
end
luatexbase.add_to_callback('process_input_buffer', comment, 'comment')
end{luacode*}
begin{document}
1 /*HIDDEN*/ 2
1 /*HIDDEN
HIDDEN*/ 2
1/*HIDDEN
HIDDEN
HIDDEN*/2
1 /*HIDDEN
HIDDEN*/ 2 /*HIDDEN*/ 3
1 /*HIDDEN*/ 2 /*HIDDEN
HIDDEN*/ 3
end{document}
add a comment |
Here's a poor man's version of the answer linked by Aditya above. It doesn't require ConTeXt but it does need to be compiled with LuaTeX. With it you can use C style comments: /*comment*/. A potential downside is that it "works" even in a verbatim environment. It works in all situations I can think of.
This input:

Gives this output:

documentclass{article}
usepackage{luacode}
begin{luacode*}
commenting = false
local gsub = string.gsub
local opencomm = "%/%*(.*)"
local closecomm = "(.-)%*%/"
function comment(s)
if not commenting then
s = gsub(s,opencomm,
function(s1)
commenting = true
s1 = gsub(s1,closecomm,function(s2) commenting = false return "" end,1)
if commenting then return "" else
return comment(s1)
end
end
)
else
s = gsub(s,"(.+)",
function(s3)
s3 = gsub(s,closecomm,function(s4) commenting = false return "" end,1)
if commenting then return "%" else
return comment(s3)
end
end
)
end
return s
end
luatexbase.add_to_callback('process_input_buffer', comment, 'comment')
end{luacode*}
begin{document}
1 /*HIDDEN*/ 2
1 /*HIDDEN
HIDDEN*/ 2
1/*HIDDEN
HIDDEN
HIDDEN*/2
1 /*HIDDEN
HIDDEN*/ 2 /*HIDDEN*/ 3
1 /*HIDDEN*/ 2 /*HIDDEN
HIDDEN*/ 3
end{document}
add a comment |
Here's a poor man's version of the answer linked by Aditya above. It doesn't require ConTeXt but it does need to be compiled with LuaTeX. With it you can use C style comments: /*comment*/. A potential downside is that it "works" even in a verbatim environment. It works in all situations I can think of.
This input:

Gives this output:

documentclass{article}
usepackage{luacode}
begin{luacode*}
commenting = false
local gsub = string.gsub
local opencomm = "%/%*(.*)"
local closecomm = "(.-)%*%/"
function comment(s)
if not commenting then
s = gsub(s,opencomm,
function(s1)
commenting = true
s1 = gsub(s1,closecomm,function(s2) commenting = false return "" end,1)
if commenting then return "" else
return comment(s1)
end
end
)
else
s = gsub(s,"(.+)",
function(s3)
s3 = gsub(s,closecomm,function(s4) commenting = false return "" end,1)
if commenting then return "%" else
return comment(s3)
end
end
)
end
return s
end
luatexbase.add_to_callback('process_input_buffer', comment, 'comment')
end{luacode*}
begin{document}
1 /*HIDDEN*/ 2
1 /*HIDDEN
HIDDEN*/ 2
1/*HIDDEN
HIDDEN
HIDDEN*/2
1 /*HIDDEN
HIDDEN*/ 2 /*HIDDEN*/ 3
1 /*HIDDEN*/ 2 /*HIDDEN
HIDDEN*/ 3
end{document}
Here's a poor man's version of the answer linked by Aditya above. It doesn't require ConTeXt but it does need to be compiled with LuaTeX. With it you can use C style comments: /*comment*/. A potential downside is that it "works" even in a verbatim environment. It works in all situations I can think of.
This input:

Gives this output:

documentclass{article}
usepackage{luacode}
begin{luacode*}
commenting = false
local gsub = string.gsub
local opencomm = "%/%*(.*)"
local closecomm = "(.-)%*%/"
function comment(s)
if not commenting then
s = gsub(s,opencomm,
function(s1)
commenting = true
s1 = gsub(s1,closecomm,function(s2) commenting = false return "" end,1)
if commenting then return "" else
return comment(s1)
end
end
)
else
s = gsub(s,"(.+)",
function(s3)
s3 = gsub(s,closecomm,function(s4) commenting = false return "" end,1)
if commenting then return "%" else
return comment(s3)
end
end
)
end
return s
end
luatexbase.add_to_callback('process_input_buffer', comment, 'comment')
end{luacode*}
begin{document}
1 /*HIDDEN*/ 2
1 /*HIDDEN
HIDDEN*/ 2
1/*HIDDEN
HIDDEN
HIDDEN*/2
1 /*HIDDEN
HIDDEN*/ 2 /*HIDDEN*/ 3
1 /*HIDDEN*/ 2 /*HIDDEN
HIDDEN*/ 3
end{document}
edited Apr 13 '17 at 12:35
Community♦
1
1
answered Dec 22 '12 at 2:46
Scott H.Scott H.
8,21722463
8,21722463
add a comment |
add a comment |
I think the most straightforward way to do this is to use a TeX editor. TeXnicCenter for instance offers to comment and uncomment marked blocks by ctrl+q and ctrl+w. This simply adds a '%' at the respective lines. This further grays out commented section, which is not the case with scripted solutions.
2
you can't have inline comments as such for example2 /* HIDDEN HIDDEN HIDDEN */ 3
– percusse
Nov 27 '13 at 21:18
1
This is true of course. A scripted version also lets hide/show comments by a simple compile flag, which can be great in drafting or reviewing work.
– Thomas Ortner
Nov 27 '13 at 21:46
add a comment |
I think the most straightforward way to do this is to use a TeX editor. TeXnicCenter for instance offers to comment and uncomment marked blocks by ctrl+q and ctrl+w. This simply adds a '%' at the respective lines. This further grays out commented section, which is not the case with scripted solutions.
2
you can't have inline comments as such for example2 /* HIDDEN HIDDEN HIDDEN */ 3
– percusse
Nov 27 '13 at 21:18
1
This is true of course. A scripted version also lets hide/show comments by a simple compile flag, which can be great in drafting or reviewing work.
– Thomas Ortner
Nov 27 '13 at 21:46
add a comment |
I think the most straightforward way to do this is to use a TeX editor. TeXnicCenter for instance offers to comment and uncomment marked blocks by ctrl+q and ctrl+w. This simply adds a '%' at the respective lines. This further grays out commented section, which is not the case with scripted solutions.
I think the most straightforward way to do this is to use a TeX editor. TeXnicCenter for instance offers to comment and uncomment marked blocks by ctrl+q and ctrl+w. This simply adds a '%' at the respective lines. This further grays out commented section, which is not the case with scripted solutions.
answered Nov 27 '13 at 21:14
Thomas OrtnerThomas Ortner
11113
11113
2
you can't have inline comments as such for example2 /* HIDDEN HIDDEN HIDDEN */ 3
– percusse
Nov 27 '13 at 21:18
1
This is true of course. A scripted version also lets hide/show comments by a simple compile flag, which can be great in drafting or reviewing work.
– Thomas Ortner
Nov 27 '13 at 21:46
add a comment |
2
you can't have inline comments as such for example2 /* HIDDEN HIDDEN HIDDEN */ 3
– percusse
Nov 27 '13 at 21:18
1
This is true of course. A scripted version also lets hide/show comments by a simple compile flag, which can be great in drafting or reviewing work.
– Thomas Ortner
Nov 27 '13 at 21:46
2
2
you can't have inline comments as such for example
2 /* HIDDEN HIDDEN HIDDEN */ 3– percusse
Nov 27 '13 at 21:18
you can't have inline comments as such for example
2 /* HIDDEN HIDDEN HIDDEN */ 3– percusse
Nov 27 '13 at 21:18
1
1
This is true of course. A scripted version also lets hide/show comments by a simple compile flag, which can be great in drafting or reviewing work.
– Thomas Ortner
Nov 27 '13 at 21:46
This is true of course. A scripted version also lets hide/show comments by a simple compile flag, which can be great in drafting or reviewing work.
– Thomas Ortner
Nov 27 '13 at 21:46
add a comment |
Short: put directlua{-- before the block and a single } after the block when compiling with Lua(La)TeX.
Long: this is a "bug" of LuaTeX turned into a feature, or what make programmers happy. Putting a double hyphen in front of a text in Lua means a single-line comment; however, since TeX strips newlines from Lua code, this appears as a single-line chunk to Lua and so all the chunk gets commented.
Not tested, but I think you could alias that as
newcommand{multlinecomment}[1]{directlua{-- #1}}
and then enclose your comment as in
multlinecomment{
My multiline
comment
with Lorem ipsum.
}
add a comment |
Short: put directlua{-- before the block and a single } after the block when compiling with Lua(La)TeX.
Long: this is a "bug" of LuaTeX turned into a feature, or what make programmers happy. Putting a double hyphen in front of a text in Lua means a single-line comment; however, since TeX strips newlines from Lua code, this appears as a single-line chunk to Lua and so all the chunk gets commented.
Not tested, but I think you could alias that as
newcommand{multlinecomment}[1]{directlua{-- #1}}
and then enclose your comment as in
multlinecomment{
My multiline
comment
with Lorem ipsum.
}
add a comment |
Short: put directlua{-- before the block and a single } after the block when compiling with Lua(La)TeX.
Long: this is a "bug" of LuaTeX turned into a feature, or what make programmers happy. Putting a double hyphen in front of a text in Lua means a single-line comment; however, since TeX strips newlines from Lua code, this appears as a single-line chunk to Lua and so all the chunk gets commented.
Not tested, but I think you could alias that as
newcommand{multlinecomment}[1]{directlua{-- #1}}
and then enclose your comment as in
multlinecomment{
My multiline
comment
with Lorem ipsum.
}
Short: put directlua{-- before the block and a single } after the block when compiling with Lua(La)TeX.
Long: this is a "bug" of LuaTeX turned into a feature, or what make programmers happy. Putting a double hyphen in front of a text in Lua means a single-line comment; however, since TeX strips newlines from Lua code, this appears as a single-line chunk to Lua and so all the chunk gets commented.
Not tested, but I think you could alias that as
newcommand{multlinecomment}[1]{directlua{-- #1}}
and then enclose your comment as in
multlinecomment{
My multiline
comment
with Lorem ipsum.
}
edited Jun 30 '15 at 7:31
answered Jun 30 '15 at 6:55
AstrinusAstrinus
1,434524
1,434524
add a comment |
add a comment |
A simple solution I use is
newcommand{comment}[1]{}
Which just defines a command that does nothing with the input (effectively commenting it out!)
Sample use:
comment{
This line of text won't show
This one won't either
}
add a comment |
A simple solution I use is
newcommand{comment}[1]{}
Which just defines a command that does nothing with the input (effectively commenting it out!)
Sample use:
comment{
This line of text won't show
This one won't either
}
add a comment |
A simple solution I use is
newcommand{comment}[1]{}
Which just defines a command that does nothing with the input (effectively commenting it out!)
Sample use:
comment{
This line of text won't show
This one won't either
}
A simple solution I use is
newcommand{comment}[1]{}
Which just defines a command that does nothing with the input (effectively commenting it out!)
Sample use:
comment{
This line of text won't show
This one won't either
}
answered 12 mins ago
ntjessntjess
886
886
add a comment |
add a comment |
protected by Community♦ Jul 5 '15 at 16:24
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
3
Related/duplicate: Commenting out large sections
– Qrrbrbirlbel
Dec 18 '12 at 7:22
3
Also see: Block comments in TeX
– Aditya
Dec 18 '12 at 8:03
Your question was pretty enough for me.
– Joker 00
Apr 27 '17 at 23:12