Coder Social home page Coder Social logo

Comments (15)

rnuske avatar rnuske commented on June 1, 2024 1

An interesting idea. I never before tried to create sections in a letter. The naive way # section one does not work

! Undefined control sequence.
<argument> \section 
                    {section one}\label {section-one}
l.95 \section{section one}\label{section-one}}

I will research where that error occurs and report back.

from komaletter.

rnuske avatar rnuske commented on June 1, 2024

It seems to be more complicated.
This package employs the KOMA-Script class scrlttr2, which does not support sections. There was a "hack" to add sections after the fact (by the author of KOMA-Script), which is now deprecated.The way recommended now is to combine KOMA-Script classes such als scrartl with the package scrletter (example).

Switching to scrletter would cause a major overhaul of the plumbing of komaletter. So, not my favorite solution. For now I will have a look at the old hack and see if I can use some of its parts.

Just to better understand your use case, are you trying to write legal letters such as this KOMA-Script dummy example?

from komaletter.

bnicenboim avatar bnicenboim commented on June 1, 2024

Hi,
not for a legal letter, but for an academic letter of motivation.
I just wanted to divide the information in sections. For now, I did it with
\vspace{.5cm}
Section
\vspace{.5cm}
But it's not the nicest approach, and sometimes spacing goes crazy.

from komaletter.

rnuske avatar rnuske commented on June 1, 2024

Hi Bruno,
I couldn't resist and added sections to the default letter layout loosely following Markus Kohm's hack. I reduced the before and after section title vertical space to something more letter friendly.

Please test my changes in branch sections and let me know what you think about the implementation and the spacing. This is a first experiment and I'm open to adjustments and better ideas ;-)

remotes::install_github("rnuske/komaletter", ref="sections")



Here some samples:

from komaletter.

bnicenboim avatar bnicenboim commented on June 1, 2024

That's great! I'll check it soon!

from komaletter.

bnicenboim avatar bnicenboim commented on June 1, 2024

Nope, it didn't work:

---
author: Bruno Nicenboim 
return-address: 
  - xxxx
  - xxx
address:
  - xxxx
 
  
subject: 
opening: Dear 
closing: Best regards,
signature: Dr. Bruno Nicenboim

lco: NF
output: komaletter::komaletter
---

text text text
## Section

blah blah

from komaletter.

rnuske avatar rnuske commented on June 1, 2024

ahh, you built your own lco. The changes are in the komaletter default lco and thus only kick in if you do not specify a custom lco. Have a look at the changed default lco and copy the last part starting with "% Hack to provide sections -------" to your lco then you should have sections in your lco as well.

Please let me know if this works.

It would be gorgeous if you could test the branch without your lco, just to check whether the changes work as intended on a different machine.

from komaletter.

bnicenboim avatar bnicenboim commented on June 1, 2024

ha, I just uninstalled R because I keep having "segfault/core dump" errors (unrelated to this package, of course). So it'll take me some time.

BTW, I didn't built the lco, I used one of the ones that come with komaletter

from komaletter.

rnuske avatar rnuske commented on June 1, 2024

ups,
I didn't spot that the lco you used is the standard french letter layout. NF is provided by KOMA-Script. On my computer (Ubuntu Linux 20.04) it is under /usr/share/texlive/texmf-dist/tex/latex/koma-script/NF.lco. NF doesn't either have the sections. So, I copied NF.lco renamed it to NF.w.sections.lco (underscores get mangeled by pandoc/LaTeX) in my working directory and added the sections-hack. See attached files (remove txt extension, it's only to get the files into github)




puh, I guess I will start working on the switch to "scrartl + scrletter" sooner rather than later

from komaletter.

rnuske avatar rnuske commented on June 1, 2024

@bnicenboim
I would like to merge the branch to master.

Were you able to test the default-lco with sections or the NF.w.sections.lco? Do you approve of the vertical spacing around the sections?

Thanks Robert

from komaletter.

bnicenboim avatar bnicenboim commented on June 1, 2024

I copied this file "NF.w.sections.lco" and it didn't work. (I got an error when I tried to knit the doc.) Should I overwrite the original file?

from komaletter.

rnuske avatar rnuske commented on June 1, 2024

You do not need to overwrite the original NF.lco.

The easiest case is NF.w.sections.lco and BrunosTest.Rmd in the same directory. BrunosTest.Rmd should than knit without problems. At least it works for me in RStudio with the the CRAN version and section-Branch of the Github version.

from komaletter.

bnicenboim avatar bnicenboim commented on June 1, 2024

Yes, it worked! Sorry for the delay.
I would prefer to have a little bit more space below the section, but besides that it looks great. Even the numbering works.

(It doesn't distinguish between #,##, and ###, but I guess it's fine like that).

And notice that it doesn't accept paragraphs ####.

from komaletter.

rnuske avatar rnuske commented on June 1, 2024

good to know, thanks for testing.

I followed the example of Markus Kohm and chose \normalsize\bfseries\sffamily for the sections. So all section level have the same styling. The only difference is the amount of space before and after the sections (see test_sections.pdf).

Would you like to have the fourth level of sectioning? I thought maybe three level would be enough in a letter. If the pargraph is needed I could add it, maybe just \normalsize\sffamily without making it bold.

Would you like more space after section, subsection and subsubsection or only after subsubsection?

from komaletter.

bnicenboim avatar bnicenboim commented on June 1, 2024

I think the spacing looks fine in your example.

And adding the paragraph is a good idea.

from komaletter.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.