0

I've been able to get comment environments to work elsewhere for what I need, which I'm kind of amazed at myself, given the complexity of everything so far, but it breaks in location. I apologize if this MWE is long, I wasn't entirely sure how much more I can remove before the problem loses itself.

\documentclass{article}
\usepackage{comment}

%\excludecomment{showme}
\includecomment{showme}

\begin{document}
\begin{tabular}{|l|ll|l|l|} \hline
A column & \multicolumn{2}{c|}{some other column} & yup & here too \\ \hline
\textbf{1} & & \parbox{3.9in}{Some Stuff Here} & & \\ \hline
%\begin{showme}
\multicolumn{3}{|p{4.5in}|}{\raggedright These rows are dependent on include or exclude from the master file} & \multicolumn{2}{l|}{} \\ \hline
%\end{showme}
\hline\multicolumn{5}{|p{6.34in}|}{\raggedright \textbf{More Stuff}} \\ \hline
\end{tabular}
\end{document}

The above will typset and show the third row. I can also comment out the third row manually and still typest fine.

The idea of the \begin{showme} is that the \includecomment will be in another file, which inputs this file during Typeset. In all other cases where I'm using this method across multiple files in this project, all works fine, mostly. The problem is when I uncomment the \begin{showme} and \end{showme} lines and attempt to allow the include or exclude commands take control, I end up with two different broken typesets.

\include results in:

Including 'showme' comment. Straight input of comment.cut.  
(comment.cut ! Misplaced \omit. \multispan ->\omit  
                   \@multispan  l.1 ...on include or exclude from the master file}  
                                                   & \multicolumn{2}{l|}{} \...  

Excluding results in:

Excluding 'showme' comment. ! Misplaced \noalign. \hline ->\noalign  
                  {\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet... l.14 \hline  
           \multicolumn{5}{|p{6.34in}|}{\raggedright \textbf{More Stuff}} \\...

As I said, I can control this row showing or hiding manually with a single comment %. So why does it break when trying to control it with the comment environment?

  • 1
    \multicolumn has to be the first thing in its cell (after expansion) so you can not have \begin or any environment there. – David Carlisle Mar 5 '18 at 16:52
  • since log files are aligned like code, i indented the log file "quotes" (within the quoting environment) so the original line breaks (which indicate structure) don't get lost. – barbara beeton Mar 5 '18 at 16:58
  • If you're open to it, you can use \showmetabular{\multicolumn{.}{..}{...}} where \newcommand{\showmetabular}[1]{} to gobble a line in a tabular and change that to \newcommand{\showmetabular}[1]{#1} to have it show the line. – Werner Mar 5 '18 at 17:00
  • Werner's option works for me, thanks! (I can't really mark this as an answer though) – ctclark1 Mar 5 '18 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.