Cody

# Problem 1860. Remove TeX from string

Solution 316100

Submitted on 6 Sep 2013 by Sky Sartorius
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% texStr = '\beta'; txt = 'beta'; assert(isequal(tex2txt(texStr),txt))

txt = \beta txt = \beta txt = \beta txt = beta

2   Pass
%% texStr = ['\fontsize{16}black {\color{magenta}magenta '... '\color[rgb]{0 .5 .5}teal \color{red}red} black again']; txt = 'black magenta teal red black again'; assert(isequal(tex2txt(texStr),txt))

txt = \fontsize{16}black {\color{magenta}magenta \color[rgb]{0 .5 .5}teal \color{red}red} black again txt = \fontsize{16}black {magenta teal red} black again txt = black {magenta teal red} black again txt = black magenta teal red black again

3   Pass
%% texStr = {'We need to work with cells, too' '(for {\bfmultiline} labels) and' 'return strings with newline characters.'}; txt = sprintf(['We need to work with cells, too\n' ... '(for multiline labels) and\n' ... 'return strings with newline characters.']); assert(isequal(tex2txt(texStr),txt))

txt = 'We need to work with cells, too' '(for {multiline} labels) and' 'return strings with newline characters.' txt = 'We need to work with cells, too' '(for {multiline} labels) and' 'return strings with newline characters.' txt = 'We need to work with cells, too' '(for {multiline} labels) and' 'return strings with newline characters.' txt = 'We need to work with cells, too' '(for multiline labels) and' 'return strings with newline characters.' txt = We need to work with cells, too (for multiline labels) and return strings with newline characters.

4   Pass
%% texStr = '\slRemove {\bfall} \itof \rmthese.'; txt = 'Remove all of these.'; assert(isequal(tex2txt(texStr),txt))

txt = Remove {all} of these. txt = Remove {all} of these. txt = Remove {all} of these. txt = Remove all of these.

5   Pass
%% txt = 'variable_i^2/pi'; texStr = texlabel(txt); assert(isequal(tex2txt(texStr),txt))

txt = {variable}_{i}^{2}/{\pi} txt = {variable}_{i}^{2}/{\pi} txt = {variable}_{i}^{2}/{\pi} txt = variable_i^2/pi