1

I am using cweb from TeX Live as installed with macports, and I am using the LaTeX document class cweb.

When I insert a named chunk in my code, as such

\documentclass{cweb}

\begin{document}

@ Hello, world.

@<print ...@>=
printf( "Hello, world!\n" );
@

@c

int main( int __unused argc, char __unused *argv[] )
{
  @<print hello world@>

  return 0;
}
@

\end{document}

the newline after the chunk name print hello world and before return 0; is missing.

That is, my pdf is rendered something like

<print hello world>return 0;

which makes using cweb unusable for my purpose.

Is this a bug in the cweb document class or am I doing something wrong here?

  • 1
    Welcome to TeX.SX! Please don't post code fragments. Instead, put your fragments into a complete compilable document that shows the problem. – BambOo Oct 13 '18 at 11:33
  • Thanks, I've expanded the example to be complete document which demonstrates the problem; at least for me. – Johann Oskarsson Oct 13 '18 at 13:22
2

Use @/ to add a manual line break in the cweave output:

{
  @<print hello world@>@/
  return 0;
}

produces

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.