Skip to content

Commit

Permalink
Merge pull request #946 from AlbertoCuadra/develop
Browse files Browse the repository at this point in the history
Solve: minor bug with some species from Burcat's database
  • Loading branch information
AlbertoCuadra authored Feb 8, 2024
2 parents ce2c410 + 0ad3e7f commit 2767471
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions utils/display/species2latex.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,20 @@
% Check suffix
index = regexp(speciesLatex, '_[a-zA-Z]');
speciesLatex(index) = '';

% Check long numbers
speciesLatex = strrep(speciesLatex, '}_{', '');


% Joining the Burcat subscript with the previous subscript
[ind_start, ind_end] = regexp(speciesLatex, '(?=_{)(.*?)(?=})', 'once');
FLAG_DOUBLE_SUBSCRIPTS = contains(speciesLatex, '_{\rm M}') && ind_start && ind_end;
[~, ind_end] = regexp(speciesLatex, '(?=_{)(.*?)(?=})');
FLAG_DOUBLE_SUBSCRIPTS = contains(speciesLatex, '_{\rm M}') & length(ind_end) > 1;

if FLAG_DOUBLE_SUBSCRIPTS
% Remove _M subscript
speciesLatex = strrep(speciesLatex, '_{\rm M}', '');
% Join _M subscript with the first one
speciesLatex = [speciesLatex(1:ind_end), ', \rm{M}', speciesLatex(ind_end+1:end)];
speciesLatex = [speciesLatex(1:ind_end(end-1)), ', \rm{M}', speciesLatex(ind_end(end-1) + 1:end)];
% Check concatenate $$
speciesLatex = strrep(speciesLatex, '$$', '');
end


% Check long numbers
speciesLatex = strrep(speciesLatex, '}_{', '');
end

0 comments on commit 2767471

Please sign in to comment.