ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Jeroen <contextntg@gmail.com>
Subject: [NTG-context] Re: Text in Margin
Date: Mon, 19 Feb 2024 22:00:29 +0100	[thread overview]
Message-ID: <b950ec31-35e8-7216-afcc-a15160d6e2fc@gmail.com> (raw)
In-Reply-To: <CAPtmdbPeJhPfT6UaqBsmPBCmRb4Y0_HUuamKMCZtX2L4u7sb-w@mail.gmail.com>

Jeroen schrieb am 19.02.2024 um 14:14:
> In a textbook I am looking to place a large left margin at every page of 
> each chapter. At left printed pages a left margin and at right printed 
> pages a right margin, so like a double sided construction. In this 
> margin I would like to place:

You can use a custom layout with a narrow text block and a wide 
rightmargin area.

> 1. Keywords and small descriptions to emphasize some text from the textflow

Use the \inright etc. commands or create your own commands based on 
\inright, look at the margindata mechanism for more information.

> 2. Figures

You can change the default location of figures from the text block to 
the margin area.

> 3. An expansion of a table that is placed in the main textflow but that 
> needs to cover a wider range then the text area so it expands into the 
> margin

In the example below I added a check to the table float to either center 
the small tables or align wide tables on the inner margin which extend 
into the margin area. While this method works in a simple example for a 
real document I suggest to create a clone of the table float (e.g. 
widetable) because the method in the example can lead to 
problems/limitations.

> What is the the easiest way to achieve this?

%%%% begin example
\setuppagenumbering
   [alternative=doublesided]

\setuplayout
   [width=10cm,
    rightmargin=6cm]

\showframe

\def\FloatTableALignment
   {\dowithnextbox
      {\ifdim\nextboxwd>\textwidth
         \doalignedline{inner}{\flushnextbox}%
       \else
         \flushnextbox
       \fi}
      \hbox}

\setupfloat[table][command=\FloatTableALignment]

\setupfloat[figure][default=rightmargin]

\starttext

\inright{Lorem ipsum \unknown}\samplefile{lorem}

\startplacefigure
   \externalfigure[dummy][width=\rightmarginwidth]
\stopplacefigure

\samplefile{lorem}

\startplacetable
   \bTABLE
     \bTR
       \bTD one \eTD
       \bTD two \eTD
       \bTD three \eTD
     \eTR
   \eTABLE
\stopplacetable

\samplefile{lorem}

\startplacetable
 
\bTABLE[textwidth=\dimexpr\textwidth+\rightmarginwidth+\rightmargindistance\relax,option=stretch]
     \bTR
       \bTD one \eTD
       \bTD two \eTD
       \bTD three \eTD
     \eTR
   \eTABLE
\stopplacetable

\samplefile{lorem}

\stoptext
%%% end example

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2024-02-19 21:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 13:14 [NTG-context] " Jeroen
2024-02-19 21:00 ` Wolfgang Schuster [this message]
2024-02-20  7:39 ` [NTG-context] " Henning Hraban Ramm
2024-02-20  2:22 Andres Conrado Montoya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b950ec31-35e8-7216-afcc-a15160d6e2fc@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=contextntg@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).