Menu

#12 Wishlist: configurable "wrapping" command for specific text elements

once upon a time
new-feature
2023-02-20
2021-06-24
No

Management of document elements is ultra-flexible in KOMA-Script. However to obtain certain effects, unless I am missing something, you need to go very low-level.

For instance, making section headings uppercase or underlined or double-spaced is not that easy because the corresponding commands need to wrap their argument, differently from usual font commands that apply to whatever follows them.

Is it really needed to redefine the \sectionlinesformat etc altogether to obtain similar effects?

Is there any plan for the provision of a configurable wrapping command for specific elements?

Discussion

  • Markus Kohm

    Markus Kohm - 2021-06-24
    • labels: --> unclear problem
    • Milestone: KOMA-Script 3.34 --> once upon a time
     
  • Markus Kohm

    Markus Kohm - 2021-06-24

    Double spacing is easy to do without changing \sectionlinesformat, because the baseline skip is a font feature.

    Underline and uppercase are difficult in TeX, because they are not available by switches. So, yes, you have to redefine a command, that expects arguments. And in KOMA-Script these are usually format commands like \sectionlinesformat. I cannot see, that this is a problem at all.

     
  • Sergio Callegari

    Sorry, I meant double letterspacing, which soul can do similarly to underline. But as you say, it is achieved with a "wrapping" command that takes the item to be double letterspaced as an argument. Yes, you can change \sectionlinesformat, but unless I mismanaged it takes some work (as below where the loose spacing is because of expl3).

    \renewcommand* { \sectionlinesformat } [ 4 ]
      {
        \str_case:nn { #1 }
          {
            { section }
              {
                \@hangfrom { \hskip #2 #3 }
                { \doublespaced { \MakeUppercase { #4 } } }
              }
            { subsection }
              {
                \@hangfrom { \hskip #2 #3 }
                { { \MakeUppercase { #4 } } }
              }  
            { subsubsection }
              {
                \@hangfrom { \hskip #2 #3 }
                { { #4 } }
              }  
          }
      }
    

    That is because \sectionlinesformat works for multiple element types (section, subsection, etc) and does more than wrapping the heading title (in fact it takes 4 arguments).

    My question is whether it would not be possible to introduce some \sectiontitleformat, \subsectiontitleformat, etc, taking just the heading title as an argument so that one could merely do

    \renewcommand*{\sectiontitleformat`}[1]{%
        \doublespaced{\MakeUppercase{#1}}%
     }
    

    without having to copy over all the rest of \sectionlinesformat (which incidentally could also change in incompatbile ways with future versions of KOMA-Script)

     

    Last edit: Sergio Callegari 2021-06-24
    • Markus Kohm

      Markus Kohm - 2021-10-15

      Maybe this would make things a little bit easier for you, but it would make it more complicated for user, who want to change the general formatting of all levels.

      Moreover, \sectionlinesformat is a low level KOMA-Script command, if standard features that can be changed e.g. by options of \RedeclareSectionCommand are not enough for a user (or strictly speaken for CI developers). I do not think, that it is a good idea to make things too easy at this level. Because average users are already often mislead to do typographically awful things.

      Advanced users and developers should be able to define their own extended version of \sectionlinesformat, to allow either to redefine single levels or the titles of single levels, e.g.

      \newcommand*{\sectionlinesformat}[4]{%
        \@ifundefined{formatof#1level}{%
          \@hangfrom{\hskip #2\relax#3}%
          \@nameuse{#1titleformat}{#4}%
        }{\@nameuse{formatof#1level}}%
      }
      

      So, no, I do not think, that make any change here is needed or would be a real improvement.

       
  • Markus Kohm

    Markus Kohm - 2021-10-15
    • labels: unclear problem -->
     
  • Markus Kohm

    Markus Kohm - 2021-10-15
    • labels: --> feature request, scrartcl, scrreprt, scrbook
    • assigned_to: Markus Kohm
     
  • Markus Kohm

    Markus Kohm - 2023-02-20
    • status: open --> new-feature
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.