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

ArrayOptions IndexOutOfBoundsException #62

Open
ljyao opened this issue Dec 30, 2019 · 7 comments
Open

ArrayOptions IndexOutOfBoundsException #62

ljyao opened this issue Dec 30, 2019 · 7 comments

Comments

@ljyao
Copy link

ljyao commented Dec 30, 2019

ArrayOptions

 fun getAlignment(i: Int): TeXConstants.Align {
        return options[i + 1].alignment
    }

There is a problem with this function

 public ArrayOptions complete(final int n) {
        final int s = options.size();
        for (int i = 0; i < n - s; ++i) {
            addAlignment(TeXConstants.Align.CENTER);
        }
        return this;
    }

Because its options.size == n+1 ,Should be like this for (int i = 0; i <= n - s; ++i)

Test case

\begin{array}{cc}{-6-10} & {6-0} & {0+10} \\{9-35}& {3-5} & {12-30}\end{array}
@murkle
Copy link
Collaborator

murkle commented Dec 30, 2019

Does it work in the "experimental" branch?

@ljyao
Copy link
Author

ljyao commented Dec 30, 2019

Does it work in the "experimental" branch?

No, you can test this test case

\begin{array}{cc}{-6-10} & {6-0} & {0+10} \{9-35}& {3-5} & {12-30}\end{array}

@murkle
Copy link
Collaborator

murkle commented Dec 31, 2019

Are you sure your syntax is right? It looks a bit odd eg \{

Try
{\begin{array}{cc}-6-10&9-35 \\ 6-0&3-5 \\ 0+10&12-30 \\ \end{array}}

@ljyao
Copy link
Author

ljyao commented Dec 31, 2019

Are you sure your syntax is right? It looks a bit odd eg \{

Try
{\begin{array}{cc}-6-10&9-35 \\ 6-0&3-5 \\ 0+10&12-30 \\ \end{array}}

Sorry,\ should be\\

\begin{array}{cc} {-6-10} & {6-0} & {0+10} \\{9-35}& {3-5} & {12-30}\end{array}

@murkle
Copy link
Collaborator

murkle commented Dec 31, 2019

So there's a "c" missing - try:

\begin{array}{ccc} {-6-10} & {6-0} & {0+10} \\{9-35}& {3-5} & {12-30}\end{array}

@ljyao
Copy link
Author

ljyao commented Dec 31, 2019

So there's a "c" missing - try:

\begin{array}{ccc} {-6-10} & {6-0} & {0+10} \\{9-35}& {3-5} & {12-30}\end{array}

So what does ArrayOptions. complete function mean?

The following align parameter can be missing

@calixteman
Copy link
Contributor

You're right the goal is to have auto "c" for missing specifiers.
Feel free to propose a patch and a test (https://github.com/opencollab/jlatexmath/tree/experimental/jlatexmath/src/test/resources)

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

No branches or pull requests

3 participants