From 64c953aa7d01120da6b89ed1cf74c6128d168952 Mon Sep 17 00:00:00 2001 From: Andrew Scholer Date: Tue, 11 Aug 2026 14:52:51 -0700 Subject: [PATCH 1/3] Schema: console allows input and output with no restrictions on order --- schema/pretext.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/schema/pretext.xml b/schema/pretext.xml index 9dbc73b1e..07c7f6f0e 100644 --- a/schema/pretext.xml +++ b/schema/pretext.xml @@ -1317,10 +1317,7 @@ attribute continuation {text}?, attribute width {text}?, attribute margins {text}?, - ( - ConsoleInput, - ConsoleOutput? - )+ + ( ConsoleInput | ConsoleOutput )+ } ProgramPreamble = element preamble { From b1d9b8a5255c0d6ebf00d61165c0364310b0ea8f Mon Sep 17 00:00:00 2001 From: Andrew Scholer Date: Tue, 11 Aug 2026 14:53:21 -0700 Subject: [PATCH 2/3] Guide: document that console supports input and output in any order --- doc/guide/author/topics.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/guide/author/topics.xml b/doc/guide/author/topics.xml index 92350435b..39fe24179 100644 --- a/doc/guide/author/topics.xml +++ b/doc/guide/author/topics.xml @@ -3792,7 +3792,7 @@ Content and Placement of Consoles -

A console is a transcript of an interactive session in a terminal or console at a command-line. It is a sequence of the following elements, in this order, possibly repeated many times as a group: input, and output. The output is optional. The content of these two elements is treated as verbatim text (see ), subject to all the exceptions for exceptional characters (see ). A prompt attribute on the input can be supplied to provide a system prompt distinct from the actual commands. The default prompt is a dollar sign followed by a space. If it is more convenient prompt may be supplied on the console, to be used in each enclosed input. If you do not want any prompts at all, just use an empty value for prompt. A continuation attribute may also be supplied at the input or console. If present, it will apply to the start of each input line following the first.

+

A console is a transcript of an interactive session in a terminal or console at a command-line. It is a sequence of the following elements, in any order, possibly repeated many times: input, and output. The content of these two elements is treated as verbatim text (see ), subject to all the exceptions for exceptional characters (see ). A prompt attribute on the input can be supplied to provide a system prompt distinct from the actual commands. The default prompt is a dollar sign followed by a space. If it is more convenient prompt may be supplied on the console, to be used in each enclosed input. If you do not want any prompts at all, just use an empty value for prompt. A continuation attribute may also be supplied at the input or console. If present, it will apply to the start of each input line following the first.

A console may be wrapped in a listing, see . This will behave similar to a figure, with the caption displayed below, and a number assigned. So, in particular, if your program is important enough to cross-reference, it is an enclosing listing that serves as the target.

From 807a91dce9002d2471c9ab9e5b759b5286c2106b Mon Sep 17 00:00:00 2001 From: Andrew Scholer Date: Tue, 11 Aug 2026 14:53:46 -0700 Subject: [PATCH 3/3] Sample article: add sample of console with output at start --- examples/sample-article/sample-article.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/examples/sample-article/sample-article.xml b/examples/sample-article/sample-article.xml index 2b3bc8b45..177f3d7be 100644 --- a/examples/sample-article/sample-article.xml +++ b/examples/sample-article/sample-article.xml @@ -11509,6 +11509,16 @@ along with PreTeXt. If not, see . +

A console may start with output. This is useful if you are showing sample use of a program.

+ + Console session, starting with program output + + Enter a number: + 42 + You entered 42. + + +

Notice in the HTML version of the above example that when you highlight all, or a portion, of the listing for a cut-and-paste that the prompts are not included.

Now a test of some listings (and pre-formatted text) in a block that likely has a background color in an HTML version.