Skip to content

CJK brackets at the beginning of paragraph #4011

Open

Description

@minamotorin

Description

When paragraph indentation is enabled, positioning of brackets at the beginning of paragraph doesn't follow §3.1.5 of Requirements for Japanese Text Layout.
Example code is below.

// This program is public domain (CC0).
#set page(
  width: 210mm,
  margin: (left: 30mm, right: 210mm-30mm-10em),
)
#set par(
  leading: 1em
)
#show par: set block(
  spacing: 2.5em
)

「日日日日日日日日日「日

#set par(first-line-indent: 1em)

「日日日日日日日日「日

#h(-0.5em)「日日日日日日日日「日

brac

The first paragraph is an example of paragraph indentation is not enabled, and the second one is an example of paragraph indentation is enabled.

The third paragraph is an example of the expected result that follows §3.1.5 of Requirements for Japanese Text Layout.

Thanks.

Reproduction URL

No response

Operating system

macOS

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Apr 25, 2024
  2. Leedehai commented on Apr 26, 2024

    @Leedehai
    Contributor

    https://typst.app/docs/reference/model/par/#parameters-first-line-indent mentioned "Only the first line of a consecutive paragraph will be indented (not the first one in a block or on the page)." -- a limitation, yes.. Typst wants to change that but it's not trivial.

  3. laurmaedje commented on Apr 29, 2024

    @laurmaedje
    Member

    I think the issue here differs from #311. If I'm understanding correctly, it's more that a bracket shouldn't disrupt the grid-like alignment of characters.

  4. added
    text
    on Apr 29, 2024
  5. minamotorin commented on May 6, 2024

    @minamotorin
    Author

    The key point of this issue is that the space between left edge of paragraph and “「” is effectively 1.5 em, not the 1 em specified by #set par(first-line-indent: 1em).

  6. peng1999 commented on May 19, 2024

    @peng1999
    Contributor

    The third paragraph is an example of the expected result that follows §3.1.5 of Requirements for Japanese Text Layout.

    Note that JLREQ provides three possible options in that chapter, and Typst just behaves the same as option ③ optoin ① in Figure 71. So the current behavior is indeed conform to JLREQ. This issue should be a feature request rather than a bug report.

    cc @Enivex maybe you want to change the issue tags and names.


    Edit: See below

  7. added
    feature request
    and removed
    bug
    on May 19, 2024
  8. minamotorin commented on May 19, 2024

    @minamotorin
    Author

    @peng1999

    Typst just behaves the same as option ③ in Figure 71.

    No. Option 3 require the space between the left edge of the paragraph and “「” at the beginning of a paragraph to be 1/2 em, but the actual space is 3/2 em as I described first.
    This is same as option 2 rather than option 3.

    However, option 2 require the space between the left edge of the paragraph and “「” at the beginning of a line in the middle of a paragraph to be 1/2 em. But the actual space is 0 em.
    This is same as option 1 or option 3.

    Figure 71 of JLREQ
    (Quoted from Figure 71 of Requirements for Japanese Text Layout by W3C, permissive document license.)


    feature request

    Of course, it is better the user can choose which option to use.

  9. peng1999 commented on May 19, 2024

    @peng1999
    Contributor

    No. Option 3 require the space between the left edge of the paragraph and “「” at the beginning of a paragraph to be 1/2 em, but the actual space is 3/2 em as I described first.

    Sorry, I made a mistake. The problem you provide do exist. And I made another mistake in previous comment: Typst currently follows option ①, not ③.

    And the bug is: CJK punctuation at the start of paragraphs are not adjusted sometimes, and it is tracked in #2348.

    So your issue splits into two parts: the bug part is a duplication of #2348, and the feature request part is valid. But I suggest change the name the issue to something like "Options for Positioning of Opening Brackets".

  10. minamotorin commented on May 19, 2024

    @minamotorin
    Author

    @peng1999

    So your issue splits into two parts: the bug part is a duplication of #2348, and the feature request part is valid.

    I couldn't find #2348 in the past and this issue is duplicate of it. Thanks!

    I close this because this is just duplicate of #2348 and I think that feature request should be discussed in separated new issue.

  11. minamotorin commented on May 19, 2024

    @minamotorin
    Author

    This is not duplicate of #2348.

    The cause of #2348 seems to be that the space between the left edge of the paragraph and “「” at the beginning of a paragraph is used to adjust the line length.
    But this issue is about the amount of the space before it is used for adjustment.

  12. minamotorin commented on May 19, 2024

    @minamotorin
    Author

    @peng1999
    I think current behavior of typst does not satisfy any of option in Requirements for Japanese Text Layout.
    Option 1 require the space between the left edge of the paragraph and “「” at the beginning of a paragraph to be 1 em, but the actual space is 3/2 em.

    Here is table about amount of indentation.

    paragraph starting with “「” line starting with “「” and not beginning of paragraph normal beginning of paragraph
    Option 1 of §3.1.5 of Requirements for Japanese Text Layout 1 em 0 em 1 em
    Option 2 of §3.1.5 of Requirements for Japanese Text Layout 3/2 em 1/2 em 1 em
    Option 3 of §3.1.5 of Requirements for Japanese Text Layout 1/2 em 0 em 1 em
    typst (with #set par(first-line-indent: 1em)) 3/2 em 0 em 1 em

    But if this is the typst specification, this is definitely a feature request.

  13. peng1999 commented on May 19, 2024

    @peng1999
    Contributor

    The cause of #2348 seems to be that the space between the left edge of the paragraph and “「” at the beginning of a paragraph is used to adjust the line length.
    But this issue is about the amount of the space before it is used for adjustment.

    Suppose we have first-line-indent set to 1em and the first character is 「. Currently in Typst it becomes: <1em fixed space> + <0.5em shrinkable space> + <half width 「>

    In summary, the two issue is essentially the same and can be fixed by a single action: remove the shrinkable space.

  14. minamotorin commented on May 19, 2024

    @minamotorin
    Author

    the two issue is essentially the same and can be fixed by a single action: remove the shrinkable space.

    I agree about the solution.
    But I'll keep this issue open because #2348 can be fixed with a different solution, make the space unshrinkable.

  15. added
    cjk
    on Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cjkfeature requesttext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions