Graphics, Figures & TablesNewline before verbatim envir

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
erwann
Posts: 75
Joined: Thu Aug 25, 2016 2:24 am

Newline before verbatim envir

Post by erwann »

How can I suppress the line between 'Input' and the verbatim environment that shows in the output?

Code: Select all

\documentclass{l3doc}
\usepackage{expl3}
\usepackage{xparse}
\usepackage{float}
\usepackage{ccaption}
\usepackage{cleveref}
    
\begin{document}

\floatstyle{ruled}
\newfloat{Program}{h}{lop}%[section]
\begin{Program}
\textbf{Input}
\begin{verbatim}
  \NewDocumentCommand{\foo}{m}{Hello~#1!}
  \foo{World}
\end{verbatim}
\textbf{Output}\\
\NewDocumentCommand{\foo}{m}{Hello~#1!}
\foo{World}
\caption{Hello~World!}\label{code:helloworld}
\end{Program}

\end{document}
Screenshot from 2018-05-13 18-49-01.png
Screenshot from 2018-05-13 18-49-01.png (10.59 KiB) Viewed 4291 times
x_86 / Linux Mint 18.3 / texlive 2015.20160320-1ubuntu0.1 / TeXworks 0.5r1361 (Debian)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10330
Joined: Mon Mar 10, 2008 9:44 pm

Newline before verbatim envir

Post by Stefan Kottwitz »

Maybe a quick fix:

Code: Select all

\vspace{-\topsep}
\begin{verbatim}
...
Stefa
LaTeX.org admin
Post Reply