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

Error rendering latex of matrices assigned using eval with displayformat matrix latex #114

Open
cjwomack opened this issue Feb 8, 2024 · 0 comments

Comments

@cjwomack
Copy link

cjwomack commented Feb 8, 2024

  • xeus-octave version: Latest version on Anaconda as per previous bug report
  • Operating System: WSL2 on Ubuntu 22.04.3 on Windows 10

Description

I wanted to reduce repeated code by sprintf and eval in conjunction with a for loop. However, matrices do not render properly and show raw latex code. I suspect this is because I used eval and perhaps this use case was not thought of when writing the code re displaying matrices when using eval.

What I Did

n = [2 5 10];
q = ['i' 'ii' 'iii'];

displayformat matrix latex;

for i = 1:length(n)
    var_name = sprintf('H_%d', n(i));
    b_name = sprintf('b_%d', n(i));
    x_g_name = sprintf('x_g_%d', n(i) );
    x_b_name = sprintf('x_b_%d', n(i) );
    g_toc_name = sprintf('g_toc_%d', n(i) );
    b_toc_name = sprintf('b_toc_%d', n(i) );

    eval(['disp("R3.2' q(i) '\n------------");'])
    
    eval([b_name ' =  zeros(n(i));']);
    eval([var_name ' = hilb(n(i));']);



    tic;
    eval([ x_g_name ' = solve_eq(' var_name ', ' b_name  ')']);
    eval([g_toc_name ' = toc']);

    tic;
    eval([ x_b_name ' = ' var_name ' \ ' b_name  ';']);
    eval([b_toc_name ' = toc']);

    if i <= 3
        disp("\n")
    end

@cjwomack cjwomack changed the title Using eval to assign values to variables with displayformat matrix latex Error rendering latex of matrices assigned using eval with displayformat matrix latex Feb 8, 2024
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

1 participant