modern-cv icon indicating copy to clipboard operation
modern-cv copied to clipboard

trying to change `letter-position-pretext` errors out

Open Ablesius opened this issue 9 months ago • 9 comments

I'm trying to use modern-cv and wanted to change "Bewerbung für " to "Bewerbung als" because it's more idiomatic in my coverletter.typ. Here's what happens when I try to use it:

#letter-heading(
  job-position: "Projektmanager*in",
  letter-position-pretext: "Bewerbung als",    // THIS throws an error, see below!
  dear: "Liebes",   // necessary because otherwise "Sehr geehrte" is hard-coded; note that *this* can be set and typst compiles without problems!
  addressee: "Hiring Team von <company>",
)

I then get this error:

   ┌─ coverletter.typ:46:0
   │
46 │ letter-position-pretext: "Bewerbung als",
   │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I think this is wrong, because other keys can be overwritten, like "dear" in the example works as expected.

Ablesius avatar Feb 12 '25 17:02 Ablesius

Is there more information other than the error you posted? This doesn't tell me why it failed, but it seems that it might be just because it's not expecting that as an input.

Also can you confirm what version of the template you're using?

DeveloperPaul123 avatar Feb 13 '25 16:02 DeveloperPaul123

Hi! The version I use is 0.8.0.

I've created a minimal (not) working example: https://paste.xinu.at/OzAfH/ comment out line 19 to see the error vs not. :-)

Ablesius avatar Feb 14 '25 12:02 Ablesius

Hmm looks like this input parameter does not exist and that's why it's giving you an error. I can add it as a feature.

DeveloperPaul123 avatar Feb 14 '25 16:02 DeveloperPaul123

Thank you! Just to understand, letter-position-pretext does not yet exist as an input parameter, but curriculum-vitae and attached do; where is that defined? When I search this repo for these terms respectively, I find the same results, so it's surprising that only one of them can't be defined by the user yet.

Ablesius avatar Feb 15 '25 14:02 Ablesius

These are defined in the lang.toml file which is how I provide translations of the same text. These aren't customizable directly from the template, you would have to edit the lang.toml. In fact you could do the same for letter-position-pretext.

DeveloperPaul123 avatar Feb 16 '25 03:02 DeveloperPaul123

@Ablesius Is editing the lang.toml viable instead of adding a parameter to the template?

DeveloperPaul123 avatar Mar 03 '25 00:03 DeveloperPaul123

Hi @DeveloperPaul123, I don't think I understand how I would do that, except by forking your template? I don't see the lang.toml file in my folder. When I run typst init @preview/modern-cv:0.8.0, I just get

/t/typst_test> tree
.
└── modern-cv
    ├── coverletter2.typ
    ├── coverletter.typ
    ├── profile.png
    └── resume.typ

2 directories, 4 files

Ablesius avatar Mar 03 '25 12:03 Ablesius

Hi again,

I think I figured it out, at least as a hack:

I found the files in my cache, and copied them to ~/.local/share/typst/packages/local/modern-cv/0.8.1 (I didn't want to use the same version number in case that would break anything bad, so I could more easily return to a working state) Then I adapted the import line in my document to #import "@local/modern-cv:0.8.1": *

Then I could change the lang.toml value of letter-position-pretext.

It's a bit complicated to do just to change a single line in the document, though.

The easier hack is to use a show box:

// temporary solution: see https://github.com/DeveloperPaul123/modern-cv/issues/98#issue-2848982324
#show "Bewerbung für": "Bewerbung als"

Then I don't need to do all the extra steps.

But it's quite possible that I just found a way that was very complicated, and there's an easier solution - please advise :-)

Cheers!

Ablesius avatar Mar 03 '25 13:03 Ablesius

Ah I see, yes that's less than ideal. Didn't realize the lang.toml is only available in the cache.

DeveloperPaul123 avatar Mar 03 '25 14:03 DeveloperPaul123