Boxed latex command not working in texmacs

When Importing a latex file in Texmacs the \boxed command is not recognised and is left as is in the picture
image

The latex code snippet:

    
\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{mathtools}
\usepackage{geometry}
\usepackage[italian]{babel}
\usepackage{hyperref}
\geometry{margin=2.5cm}

\newcommand{\ds}{\displaystyle}

\Longrightarrow                   
\;C_1=\dfrac13,\;                 
C_2=-\dfrac32,\;                  
C_3=\dfrac{46}{15}.               
\]                                
                                  
\[                                
\boxed{\;y[k]=\frac13-\frac32(-3)^k+\frac{46}{15}(-2)^k+\frac1{10}3^{\,k}\;}
\]

La risposta forzata (condizioni iniziali nulle) coincide con
il solo termine particolare:
\[
\boxed{\;y_f[k]=\frac1{10}\,3^{\,k}\;}
\]

\bigskip
\subsection*{Soluzione Esercizio 3}

Hi @Gli_acopossum and welcome to the forum.

A brutal solution (I hope that someone else can improve it) is to open the imported TeXmacs file with a text editor and substitute <boxed| with <ornament| throughout.

If this is still too far away from what you’d like to have, we can investigate more (or maybe someone else in the meantime will have written a more sensible way of doing).

Thank you very much for the quick response! A brutal solution does it for me. Though I hope that it does get fixed in the future.

Is there no way to apply <ornament| via TeXmacs?

I don’t recall of a way of customizing TeXmacs LaTex import so that one can import LaTeX’s environments with given TeXmacs tags (in this case LaTeX’s boxed as TeXmacs’s ornament) and I did not figure out how to replace tags within TeXmacs (does anyone know?).

It’s hard-coded in src/Data/Convert/Tex/fromtex.cpp. To make the boxed captured, just add to somewhere around line 2000:

if (is_tuple (t, "\\boxed", 1)) return tree (ORNAMENT, l2e(t[1]));

and recompile you texmacs.

3 Likes

Hey that’s an impressively specific answer :flushed:, thank you lots!

It’s a solved problem in Liii STEM.

And it will be solved in the upcoming Mogan STEM v2025.1.0.

1 Like

@Gli_acopossum This issue has been resolved in r14759, thanks to @sharkc’s fix. Much appreciated!

3 Likes

@darcy It seems the sync to Github is broken. This commit is not showing up.

1 Like

Just sync the new commits to the github main branch now!

The commit messages will be the preferred language of the author. Since the LLM can translate it very well. We encourage the developers to use their preferred language.

Apologies, @darcy, I meant that the texmacs/texmacs Github repository is out of sync with the SVN on Savannah. I believe you are the owner of the github repo? Could you please check what has happened?

Thanks for solving this issue, @xuyiqi1. Importing @Gli_acopossum’s code snippet on TeXmac >= rev14759 now works smoothly.

Cheers, Tilda

1 Like

what about a macro? I do not think that \boxed should be translated in ornament. I guess one should define a TeXmacs macro to simulate its behaviour. e.g. an ornament with the right padding.

I’m absolutely with you @mgubi. LaTeX \boxed should definitely not be translated into ornamented as this looks decidedly ugly:

What I was trying to suggest was that instead of pasting from LaTeX as shown in b), that is

Paste -> From LaTeX should place a tabular environment inside a frame as in c) or d) by default:

as it produces the visually most pleasing results.

Besides, compared to the way LaTeX boxed is imported as of now, a tabular environment inside a frame by default would allow for more ease on the users’ side and flexibility when fine-tuning without recurring to applying the macro you suggested.

Cheers, Tilda