cmhughes / latexindent.pl

Perl script to add indentation (leading horizontal space) to LaTeX files. It can modify line breaks before, during and after code blocks; it can perform text wrapping and paragraph line break removal. It can also perform string-based and regex-based substitutions/replacements. The script is customisable through its YAML interface.
GNU General Public License v3.0
864 stars 84 forks source link

itemNames with figures #518

Closed cmo007 closed 5 months ago

cmo007 commented 6 months ago

I have some troubles when using figures (in Beamer) as itemNames. The indentation is not well aligned. There is a missing space.

original

\begin{frame}
  \frametitle{Definition \hfill(1/2)}
  \setbeamercovered{dynamic}
  \begin{outline}
    \1 The three elemental rotations may be extrinsic (rotations about the axes xyz of the original coordinate system, which is assumed to remain motionless), or intrinsic 
(rotations about the axes of the rotating coordinate system XYZ, solidary with the moving body, which changes its orientation with respect to the extrinsic frame after each 
elemental rotation)
    \1 Euler angles are typically denoted as $\alpha$, $\beta$, $\gamma$ or $\psi$, $\theta$, $\phi$/$\varphi$. Different authors may use different sets of rotation axes to define
      Euler angles, or different names for the same angles
    \1 \textcolor{blue}{Any discussion employing Euler angles should always be preceded by their definition}
    \1 Without considering the possibility of using two different conventions for the definition of the rotation axes (intrinsic or extrinsic), there exist twelve possible 
sequences of rotation axes, divided in two groups:
    \2 Proper Euler angles (z-x-z, x-y-x, y-z-y, z-y-z, x-z-x, y-x-y)
    \2 Tait–Bryan angles (x-y-z, y-z-x, z-x-y, x-z-y, z-y-x, y-x-z)
  \end{outline}
\end{frame}

yaml settings

indentAfterItems:
  outline: 1
  itemize: 1
  itemize*: 1
  enumerate: 1
  enumerate*: 1
  description: 1
  description*: 1
  list: 1

itemNames:
  item: 1
  myitem: 1
  1: 1
  2: 1
  3: 1

actual/given output

\begin{frame}
  \frametitle{Definition \hfill(1/2)}
  \setbeamercovered{dynamic}
  \begin{outline}
    \1 The three elemental rotations may be extrinsic (rotations about the axes xyz of the original coordinate system, which is assumed to remain motionless), or intrinsic
      (rotations about the axes of the rotating coordinate system XYZ, solidary with the moving body, which changes its orientation with respect to the extrinsic frame after each
      elemental rotation)
    \1 Euler angles are typically denoted as $\alpha$, $\beta$, $\gamma$ or $\psi$, $\theta$, $\phi$/$\varphi$. Different authors may use different sets of rotation axes to define
      Euler angles, or different names for the same angles
    \1 \textcolor{blue}{Any discussion employing Euler angles should always be preceded by their definition}
    \1 Without considering the possibility of using two different conventions for the definition of the rotation axes (intrinsic or extrinsic), there exist twelve possible
      sequences of rotation axes, divided in two groups:
    \2 Proper Euler angles (z-x-z, x-y-x, y-z-y, z-y-z, x-z-x, y-x-y)
    \2 Tait–Bryan angles (x-y-z, y-z-x, z-x-y, x-z-y, z-y-x, y-x-z)
  \end{outline}
\end{frame}

desired or expected output

\begin{frame}
  \frametitle{Definition \hfill(1/2)}
  \setbeamercovered{dynamic}
  \begin{outline}
    \1 The three elemental rotations may be extrinsic (rotations about the axes xyz of the original coordinate system, which is assumed to remain motionless), or intrinsic
       (rotations about the axes of the rotating coordinate system XYZ, solidary with the moving body, which changes its orientation with respect to the extrinsic frame after each
       elemental rotation)
    \1 Euler angles are typically denoted as $\alpha$, $\beta$, $\gamma$ or $\psi$, $\theta$, $\phi$/$\varphi$. Different authors may use different sets of rotation axes to define
       Euler angles, or different names for the same angles
    \1 \textcolor{blue}{Any discussion employing Euler angles should always be preceded by their definition}
    \1 Without considering the possibility of using two different conventions for the definition of the rotation axes (intrinsic or extrinsic), there exist twelve possible
       sequences of rotation axes, divided in two groups:
    \2 Proper Euler angles (z-x-z, x-y-x, y-z-y, z-y-z, x-z-x, y-x-y)
    \2 Tait–Bryan angles (x-y-z, y-z-x, z-x-y, x-z-y, z-y-x, y-x-z)
  \end{outline}
\end{frame}

anything else

Regards, Claude

cmhughes commented 6 months ago

Can you use the issue template and I'll try to help. No screenshots please, just the template.

cmo007 commented 6 months ago

This is what I did. I just added two pictures.

cmo007 commented 6 months ago

I removed pictures

cmhughes commented 6 months ago

See the formatting the person used in https://github.com/cmhughes/latexindent.pl/issues/515

Please format your issue so that it looks like this one.

cmo007 commented 6 months ago

Thank you very much for your patience. I got it! I'm very sorry.😔 I've updated (formatted) the problem description. 😀

cmhughes commented 6 months ago

Hoping to get to this over the weekend.

cmhughes commented 6 months ago

using the following

defaultIndent: " "
indentAfterItems:
  outline: 1

indentRules:      # <!---- NEW 
  1: "   "        # <!---- NEW 
  2: "   "        # <!---- NEW 

itemNames:
  1: 1
  2: 1
  3: 1

gives

\begin{frame}
 \frametitle{Definition \hfill(1/2)}
 \setbeamercovered{dynamic}
 \begin{outline}
  \1 The three elemental rotations may be extrinsic (rotations about the axes xyz of the original coordinate system, which is assumed to remain motionless), or intrinsic
     (rotations about the axes of the rotating coordinate system XYZ, solidary with the moving body, which changes its orientation with respect to the extrinsic frame after each
     elemental rotation)
  \1 Euler angles are typically denoted as $\alpha$, $\beta$, $\gamma$ or $\psi$, $\theta$, $\phi$/$\varphi$. Different authors may use different sets of rotation axes to define
     Euler angles, or different names for the same angles
  \1 \textcolor{blue}{Any discussion employing Euler angles should always be preceded by their definition}
  \1 Without considering the possibility of using two different conventions for the definition of the rotation axes (intrinsic or extrinsic), there exist twelve possible
     sequences of rotation axes, divided in two groups:
  \2 Proper Euler angles (z-x-z, x-y-x, y-z-y, z-y-z, x-z-x, y-x-y)
  \2 Tait–Bryan angles (x-y-z, y-z-x, z-x-y, x-z-y, z-y-x, y-x-z)
 \end{outline}
\end{frame}
cmo007 commented 6 months ago

Thank you very much. It works great!👍 I'm just curious why I need a special feature for such item names (figures)?

cmhughes commented 6 months ago

We have to set indent rules for item names to account for the length of the item.

On Sat, 24 Feb 2024, 13:28 cmo007, @.***> wrote:

Thank you very much. It works great!👍 I'm just curious why I need a special feature for such item names (figures)?

— Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/518#issuecomment-1962364357, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYAX3A5KUKZSEOJVORDYVHTJHAVCNFSM6AAAAABDRDVVHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRSGM3DIMZVG4 . You are receiving this because you commented.Message ID: @.***>