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 issue in matrix with an empty cell. #387

Closed
Orace opened this issue Apr 24, 2023 · 1 comment · Fixed by #388
Closed

Alignment issue in matrix with an empty cell. #387

Orace opened this issue Apr 24, 2023 · 1 comment · Fixed by #388
Assignees
Labels

Comments

@Orace
Copy link
Contributor

Orace commented Apr 24, 2023

There is an alignment problem in the matrix rendering when there is an empty cell.

Ex: \matrix{A & B \\ A & B \\ & B}
image

It seems that the issue is located in GetTopBottomPadding:

Tuple<Box, Box> GetTopBottomPadding(int i, int j)
{
var value = matrixCellGaps[i][j].Vertical;
var topBox = new StrutBox(0.0, VerticalPadding / 2 + value, 0.0, VerticalPadding);
var bottomBox = new StrutBox(0.0, VerticalPadding / 2 + value, 0.0, VerticalPadding);
return new Tuple<Box, Box>(topBox, bottomBox);
}

If one replace the shift argument by 0:

Tuple<Box, Box> GetTopBottomPadding(int i, int j)
{
    var value = matrixCellGaps[i][j].Vertical;
    var topBox = new StrutBox(0.0, VerticalPadding / 2 + value, 0.0, 0.0);
    var bottomBox = new StrutBox(0.0, VerticalPadding / 2 + value, 0.0, 0.0);
    return new Tuple<Box, Box>(topBox, bottomBox);
}

The issue disappears:
image

I don't have enough hindsight to know if there are side effects.

@ForNeVeR
Copy link
Owner

I believe that your fix is correct. I can't remember the purpose of non-zero Shift in this place either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants