5

I want to define an environment with LaTeX3 where I can supress the indention in the first line. For LaTeX2e you can use \@afterindentfalse\@afterheading.

The example use this combination. But I want to avoid this combination.

\documentclass{scrartcl}
\usepackage{lipsum}
\usepackage{expl3,xparse}
\makeatletter
\def\tempaaaa{\@afterindentfalse\@afterheading}
\makeatother
\ExplSyntaxOn
\box_new:N \l_fullwidth_store_contents_one_box

\DeclareDocumentEnvironment { fullwidth } { }
  {
   \par\noindent Starting~savebox
   \vbox_set_inline_begin:N \l_fullwidth_store_contents_one_box
   \tempaaaa
  }
  {
   \vbox_set_inline_end:
   \par The~Output:\par
    \fbox{ \box_use_clear:N \l_fullwidth_store_contents_one_box }
  }
\ExplSyntaxOff
\begin{document}
\begin{fullwidth}

FOO bar

\lipsum[1]
\end{fullwidth}
\end{document}

enter image description here

Marco Daniel
  • 95,681
  • Joseph Wright or Frank Mittelbach will probably chime in, but I think you're mostly out of luck for the moment. The work on the galley is ongoing. – Bruno Le Floch Feb 05 '12 at 14:37
  • I removed the [tag:boxes] tag because your question seems to be more general. – lockstep Feb 05 '12 at 14:41
  • @BrunoLeFloch: In this case I must use a combination of LaTeX2e and LaTeX3. The same manner must be used for \textwidth and columnwidth. Up to know I simple use \skip_set:Nn \tex_hsize:D {10cm}. The modul coffin looks also very nice but the seems to be no split operation. – Marco Daniel Feb 05 '12 at 14:48
  • @lockstep: No problem. – Marco Daniel Feb 05 '12 at 14:48
  • On splitting boxes, what we don't have is a use case and so forth. Splitting boxes is related to the output routine, which I'm working on at the moment. Use cases and potential input syntax is what is needed to add more functionality: one for LaTeX-L. – Joseph Wright Feb 05 '12 at 15:22
  • @JosephWright We could potentially have \coffin_split:NnNN <coffin> { <dim> } <top coffin> <bottom coffin> as a wrapper for \vsplit. That wouldn't be too much of a galley-bound task. Of course, we'd have to think about poles. – Bruno Le Floch Feb 05 '12 at 15:42
  • @BrunoLeFloch I'm more worried about group levels, but I see your point. One for LaTeX-L, but I'd imagine that the 'daughter' coffins would only have the standard poles. – Joseph Wright Feb 05 '12 at 15:44
  • @JosephWright I'd go for keeping all the poles, shifted appropriately (and duplicated for the two coffins). Dunno what group level problems could arise: coffins are already local (shouldn't they be global? another discussion to be had). I'm off for tonight. I'm adding "raise coffins on LaTeX-L" to my todo list. – Bruno Le Floch Feb 05 '12 at 15:49

1 Answers1

6

As Bruno remarks, dealing with galley issues is not as developed as working with low-level code. There is also the issue that changing the way galley operations are implemented is not going to be a 'totally safe' operation with LaTeX2e: you simply cannot be sure that a change will not impact on existing code. As such, working with LaTeX3-in-LaTeX2e requires a mix of LaTeX3 and LaTeX2e code. (For example, see how siunitx detects fonts using LaTeX2e's NFSS.)

The xgalley package is close to working fluidly, but may still need a few changes. With the current implementation (which I'd love to have feedback for), you want something like

\documentclass{article}
\usepackage{lipsum,expl3,xparse,xgalley}
\ExplSyntaxOn
\box_new:N \l_fullwidth_store_contents_one_box

\DeclareDocumentEnvironment { fullwidth } { }
  {

   \par\noindent Starting~savebox
   \vbox_set_inline_begin:N \l_fullwidth_store_contents_one_box
   \bool_gset_true:N \g_galley_omit_next_indent_bool
  }
  {
   \vbox_set_inline_end:
   \par The~Output:\par
    \fbox{ \box_use:N \l_fullwidth_store_contents_one_box }
  }
\ExplSyntaxOff
\begin{document}
\begin{fullwidth}

FOO bar

\lipsum[1]

\end{fullwidth}
\end{document}

Ideally, \noindent would be defined as

\bool_gset_true:N \g_galley_omit_next_indent_bool

when xgalley is loaded. However, people rely on the fact that the \noindent primitive leaves vertical mode, and so such a change breaks a lot of LaTeX2e code. Once we have a sectioning module then perhaps I can alter this, but not at the moment.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
  • The box here might be a separate galley level (I'm not clear on the wider situation), in which case you'd want to employ \galley_level: either inside a coffin or with an additional group. – Joseph Wright Feb 05 '12 at 15:25