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>,
	Jan Willem Flamma <register12c@gmail.com>
Subject: Re: using modeset
Date: Thu, 11 Jun 2020 11:34:27 +0200	[thread overview]
Message-ID: <4accb643-92d7-1342-4fa1-31850827ceee@gmail.com> (raw)
In-Reply-To: <C09CC956-F32A-4AEE-B8F6-35BC8A01A2ED@hxcore.ol>

Jan Willem Flamma schrieb am 11.06.2020 um 10:41:
> Dear list members,
> 
> I write training manuals and use the Modes mechanism a lot to create 
> documents at various competency levels using a single set of source 
> files. So far the manuals have been written in English but now a 
> separate Dutch translation has to be created.
> 
> It is important that the two manuals are setup similarly so the 
> section/subsection numbers and question numbers are the same in the 
> English manual and the Dutch manual. Note: I do not intend to create a 
> manual that has the English and Dutch text at opposite sides (as can be 
> done using streams)
> 
> I’m keen to continue using a single set of source files and thought it 
> would be best to simply type the translated sections and subsections 
> just below the original English sections and subsections using modeset. 
> This gives me the option of creating an English case and a Dutch case. 
> Within this two cases I would still apply all sorts of other modes using 
> \startmode and \doifmode.
> 
> Duplication is unavoidable but it would make sense to try and re-use the 
> existing structural elements such as \startsection \startsubsection 
> \placefigure etc as much as possible. After all, only the title and 
> caption text needs to be translated.
> 
> I tried doing this but in the case of \startchapter using a \doifmode 
> but the PDF bookmarks text is not correctly generated.

You need

\enabledirectives[references.bookmarks.preroll]

in your setup files to get the correct text in the bookmarks.

> I also tried placing a figure in between 2 modeset cases but this does 
> not work.
> 
> See attached .tex file.

A alternative to modes is the selector mechanism to choose between 
different arguments.

\setupinteraction[state=start]

\placebookmarks

\enabledirectives[references.bookmarks.preroll]

\defineselector [language] [max=2,n=1]

\startmode[en]
     \setupselector[language][n=1]
\stopmode

\startmode[nl]
     \setupselector[language][n=2]
\stopmode

\starttext

\placecontent

\section{\select{language}{English section title}{Dutch section title}}

\startplacefigure[title=\select{language}{English float title}{Dutch 
float title}]
     \externalfigure[dummy]
\stopplacefigure

\stoptext

> Finally in the attached PDF below, I noticed that a double space appears 
> depending on the position of the text and curly bracket. Is this intended?

Yes because you add spaces between the braces and the text which appear 
in the output.

\startmodeset
     [...] {<space>
         ...<space>
     }
     [...] {<space>
         ...<space>
     }
\stopmodeset

> Questions:
> 
>   * Is the modeset mechanism indeed the best way forward or are there
>     better ways to achieve the desired outcome?
>   * How can I re-use the existing ConTeXt code as much as possible and
>     still have the correct English and Dutch title and caption text for
>     all the structural elements and floats.

There are different ways with pros and contras:

   - But the english and dutch texts for each section in separate files
   - Use buffers for each paragraph and load the one you need
   - Store the texts in variables and flush the ones you need
   - Use XML as input and tags your texts which you can filter
   - ...

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2020-06-11  9:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11  8:41 Jan Willem Flamma
2020-06-11  9:34 ` Wolfgang Schuster [this message]
2020-06-11 18:53 ` BPJ
2020-06-12  5:29   ` r.ermers
2020-06-12  9:26     ` Jan Willem Flamma
2020-06-15 18:23       ` Henning Hraban Ramm
2020-06-17 12:13         ` Jan Willem Flamma

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=4accb643-92d7-1342-4fa1-31850827ceee@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    --cc=register12c@gmail.com \
    /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).