2

When adding the enumitem package, LyX allows to resume lists. This works even when a textbox is interrupting the enumeration environment, but only in the editor (LyX 2.3.0 on MacOS 10.13.6 here). Sadly, the result in the exported PDF has the wrong item number after resuming the list outside the box. I found no way of manually setting the enumeration counter. \addtocounter{enumi}{3} does not throw an error, but also doesn't change the numbering - what am I missing?

The textbox is needed to leave some space on the right for an image, which I left out in the minimum working sample. So please don't tell me I should do away with the box - it is a trick for getting the desired layout.

Please see the PDF output and minimum working sample. The desired outcome would be a 6 as the last list item counter instead of the 3 I get.

PNG of the PDF output of the script below

    #LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass scrartcl
\options twopage
\use_default_options false
\begin_modules
fix-cm
enumitem
\end_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding default
\font_roman "cmr" "Latin Modern Roman"
\font_sans "lmss" "Latin Modern Sans"
\font_typewriter "lmtt" "Latin Modern Mono"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts true
\font_sc false
\font_osf false
\font_sf_scale 100 130
\font_tt_scale 100 100
\use_microtype true
\use_dash_ligatures false
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 11
\spacing single
\use_hyperref true
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks true
\pdf_pdfborder true
\pdf_colorlinks true
\pdf_backref false
\pdf_pdfusetitle true
\pdf_quoted_options "colorlinks=true, urlcolor=blue, linkcolor=blue"
\papersize a4paper
\use_geometry false
\use_package amsmath 1
\use_package amssymb 0
\use_package cancel 0
\use_package esint 1
\use_package mathdots 0
\use_package mathtools 0
\use_package mhchem 0
\use_package stackrel 0
\use_package stmaryrd 0
\use_package undertilde 0
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date true
\justification true
\use_refstyle 0
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 2cm
\topmargin 3.3cm
\rightmargin 2cm
\bottommargin 2cm
\headheight 2.8cm
\headsep 0.5cm
\footskip 0.5cm
\secnumdepth 2
\tocdepth 2
\paragraph_separation skip
\defskip smallskip
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle fancy
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Section
\noindent
Test
\end_layout

\begin_layout Subsection
\noindent
Paragraph with numbered list
\end_layout

\begin_layout Standard
\noindent
This is a standard formatted line.
\end_layout

\begin_layout Enumerate
\noindent
This is line 1 of the numbered list.
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
 eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
 voluptua.
\end_layout

\begin_layout Enumerate
\noindent
This is line 2 of the numbered list.
 At vero eos et accusam et justo duo dolores et ea rebum.
\end_layout

\begin_layout Standard
\noindent
\begin_inset Box Frameless
position "t"
hor_pos "c"
has_inner_box 1
inner_pos "t"
use_parbox 0
use_makebox 0
width "58col%"
special "none"
height "1in"
height_special "totalheight"
thickness "0.4pt"
separation "3pt"
shadowsize "4pt"
framecolor "black"
backgroundcolor "none"
status open

\begin_layout Enumerate-Resume
This is line 3 of the numbered list and line 1 inside a box.
\end_layout

\begin_layout Enumerate-Resume
This is line 4 of the numbered list and line 2 inside a box.
\end_layout

\begin_layout Enumerate-Resume
This is line 5 of the numbered list and line 3 inside a box.
\end_layout

\end_inset


\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
addtocounter{enumi}{3}
\end_layout

\end_inset


\end_layout

\begin_layout Enumerate-Resume
\noindent
\begin_inset VSpace 4mm
\end_inset

This is line 3 of the numbered list.
 Now we can again use the full width of the page.
\end_layout

\end_body
\end_document

1 Answer 1

0

Getting no answer for two days is kind of inspiring - now I have managed to find a solution. It's rather ugly, but the output looks fine.

  1. Replace the one box by three boxes, one for each line.
  2. Insert the lines in each box, format as simple paragraph.
  3. Format the paragraphs containing the boxes as resumed enumeration.
  4. Reduce box width to account for the indentation.
  5. Add a bit of vertical space so line spacing looks right.

PDF output: PNG picture of PDF result

Source:

#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass scrartcl
\options twopage
\use_default_options false
\begin_modules
fix-cm
enumitem
\end_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding default
\font_roman "cmr" "Latin Modern Roman"
\font_sans "lmss" "Latin Modern Sans"
\font_typewriter "lmtt" "Latin Modern Mono"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts true
\font_sc false
\font_osf false
\font_sf_scale 100 130
\font_tt_scale 100 100
\use_microtype true
\use_dash_ligatures false
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 11
\spacing single
\use_hyperref true
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks true
\pdf_pdfborder true
\pdf_colorlinks true
\pdf_backref false
\pdf_pdfusetitle true
\pdf_quoted_options "colorlinks=true, urlcolor=blue, linkcolor=blue"
\papersize a4paper
\use_geometry false
\use_package amsmath 1
\use_package amssymb 0
\use_package cancel 0
\use_package esint 1
\use_package mathdots 0
\use_package mathtools 0
\use_package mhchem 0
\use_package stackrel 0
\use_package stmaryrd 0
\use_package undertilde 0
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date true
\justification true
\use_refstyle 0
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 2cm
\topmargin 3.3cm
\rightmargin 2cm
\bottommargin 2cm
\headheight 2.8cm
\headsep 0.5cm
\footskip 0.5cm
\secnumdepth 2
\tocdepth 2
\paragraph_separation skip
\defskip smallskip
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle fancy
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Section
\noindent
Test
\end_layout

\begin_layout Subsection
\noindent
Paragraph with numbered list
\end_layout

\begin_layout Standard
\noindent
This is a standard formatted line.
\end_layout

\begin_layout Enumerate
\noindent
This is line 1 of the numbered list.
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
 eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
 voluptua.
\end_layout

\begin_layout Enumerate
\noindent
This is line 2 of the numbered list.
 At vero eos et accusam et justo duo dolores et ea rebum.
\end_layout

\begin_layout Enumerate
\noindent
\begin_inset Box Frameless
position "t"
hor_pos "c"
has_inner_box 1
inner_pos "t"
use_parbox 0
use_makebox 0
width "50col%"
special "none"
height "1in"
height_special "totalheight"
thickness "0.4pt"
separation "3pt"
shadowsize "4pt"
framecolor "black"
backgroundcolor "none"
status open

\begin_layout Plain Layout
This is line 3 of the numbered list and line 1 inside a box.
\end_layout

\end_inset


\begin_inset VSpace medskip
\end_inset


\end_layout

\begin_layout Enumerate
\noindent
\begin_inset Box Frameless
position "t"
hor_pos "c"
has_inner_box 1
inner_pos "t"
use_parbox 0
use_makebox 0
width "50col%"
special "none"
height "1in"
height_special "totalheight"
thickness "0.4pt"
separation "3pt"
shadowsize "4pt"
framecolor "black"
backgroundcolor "none"
status open

\begin_layout Plain Layout
This is line 4 of the numbered list and line 2 inside a box.
\end_layout

\end_inset


\begin_inset VSpace medskip
\end_inset


\end_layout

\begin_layout Enumerate
\noindent
\begin_inset Box Frameless
position "t"
hor_pos "c"
has_inner_box 1
inner_pos "t"
use_parbox 0
use_makebox 0
width "50col%"
special "none"
height "1in"
height_special "totalheight"
thickness "0.4pt"
separation "3pt"
shadowsize "4pt"
framecolor "black"
backgroundcolor "none"
status open

\begin_layout Plain Layout
This is line 5 of the numbered list and line 3 inside a box.
\end_layout

\end_inset


\begin_inset VSpace medskip
\end_inset


\end_layout

\begin_layout Enumerate
\noindent
This is line 6 of the numbered list.
 Now we can again use the full width of the page.
\end_layout

\end_body
\end_document

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.