Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alignment #80

Open
internettechnik opened this issue Oct 28, 2024 · 7 comments
Open

alignment #80

internettechnik opened this issue Oct 28, 2024 · 7 comments
Milestone

Comments

@internettechnik
Copy link

unfortunately, the alignment seems to be centered now (0.5.1) which differs from 0.5.0 and cannot be changed / set with set text align directive.

@quachpas
Copy link
Collaborator

I wouldn't be able to guess what changed. Could you isolate your code for an example? It works on 0.5.0?

@quachpas
Copy link
Collaborator

quachpas commented Nov 7, 2024

@internettechnik ?

@RBW1999
Copy link

RBW1999 commented Nov 9, 2024

Issue

I myb had the same "issue". I didn't check between version, but I also had same weird styling when importing the package.

My issue was user related. The styles that I had applied before were the cause of the bad alignment.

image

The "Cause"

I guess glossarium uses figures and captions under the hood to link and display the entries in the glossar. So your individual styling of figures and captions will take effect on the glossar. As I understand it, this functionality of leaving the styling to the user is intendet ( #60 )

Sadly I wasnt able to reproduce a isolated example in my given time. But I can present and explain my fix.

Solution for my Issue

image

[
    #set figure(placement: none)
    #show figure: set block(width: 100%)
    #show figure.caption: c =>[
      #align(left, [#c.body])
    ]
  
    #heading([Glossar]) 
    #glossarium.print-glossary(glossar-list)
 ]
  1. I wrapped the styling and the glossar with a content block [ ] so that the style adjustment only affects the glossar.
  2. Setting the figure placement to none keeps the entries from floating to the top or bottom of the page (#set figure(placement: none))
  3. As discussed in this typst-issue-1498 the caption placement depents on the size of the figure. I therefore set the width #show figure: set block(width: 100%)
  4. After setting the width to 100% the align comment works as intendet:
#show figure.caption: c =>[
      #align(left, [#c.body])
    ]

@quachpas
Copy link
Collaborator

If you are styling figure.caption of all kinds, it will affect glossary entries, as they are indeed figure elements.
Glad you got it working!

@quachpas quachpas pinned this issue Nov 10, 2024
@internettechnik
Copy link
Author

internettechnik commented Nov 25, 2024

Dear RBW1999: Thanks for your explanations and the workaround / fix

For me following workaround works so far:

// FIX left alignment of glossary:
// With glossary 0.5.1 it is necessary
// to overwrite figure captions to be aligned left
#show figure.caption: c => block(width:100%,align(left, c.body))
#print-glossary(gls-entries)

@quachpas ... You could try this workaround solution for the "bug" by upgrading glossarium from 0.5.0 to 0.5.1 at the example given at: https://git-iit.fh-joanneum.at/oss/thesis-template

@internettechnik
Copy link
Author

glossary-version-050 glossary-aligned-left-with-050 glossary-version-051 glossary-centered-with-051 minimal-fix-for-glossary-051

@quachpas
Copy link
Collaborator

Hello @internettechnik, the only reason why you would need the additional show rule is if you have another conflicting show rule. By default, it's left-aligned (for LTR languages)

@quachpas quachpas modified the milestones: 0.5.3, 0.5.2 Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants