Opened 4 years ago

Last modified 5 months ago

#27543 needs_work enhancement

Definitions and commands in sagetex

Reported by: Aram Dermenjian Owned by:
Priority: major Milestone: sage-wishlist
Component: packages: standard Keywords: sagetex
Cc: Merged in:
Authors: aram.dermenjian Reviewers:
Report Upstream: N/A Work issues:
Branch: u/aram.dermenjian/definitions_and_commands_in_sagetex (Commits, GitHub, GitLab) Commit: dedc3560b15dd2293e612b15331b62ae794b12c0
Dependencies: Stopgaps:

Status badges

Description (last modified by Aram Dermenjian)

When using latex(Tableau([[1]])) we normally get back:

{\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|} 
{\raisebox{-.3ex}{$#1$}}}
 \raisebox{-.6ex}{$\begin{array}[b]{*{1}c}\cline{1-1}
 \lr{1}\\\cline{1-1}
 \end{array}$}
}

This is normally except when using sagetex. When sagetex runs, it encodes everything in

\newlabel{@sageinline0}{
    .... code goes here ...
}

This is normally ok except that in \newlabel we can't have \def\lr#1 (in particular we need ##1 instead of #1). This means when using the code \sage{Tableau([[1]])} in latex causes problems and doesn't allow compilation.

This ticket proposes adding a new function called sagetex() which is like latex() in that objects can define a _sagetex_ method and when sagetex() is called, the _sagetex_ method is called, and if not present, it runs latex() instead.

After this implementation, we'd propose a change to sagetex (the latex package) in order to use the sagetex() function instead of the latex() function.

The reason we have decided this method is to try and allow more flexibility in the future. In particular, (as a use case other than adding proper definition embedding) if we ever want the code in latex() versus sagetex() to be vastly different, this would allow us to do that. Additionally, we chose not to do a grep replace of #x to ##x (for x increasing) is due to the fact that there is a use case in which the user might actually want to keep #1 and not have it escaped.

Change History (20)

comment:1 Changed 4 years ago by Aram Dermenjian

Authors: aram.dermenjian
Component: PLEASE CHANGEpackages: standard
Description: modified (diff)
Keywords: sagetex added
Type: PLEASE CHANGEenhancement

comment:2 Changed 4 years ago by Aram Dermenjian

Branch: u/aram.dermenjian/definitions_and_commands_in_sagetex

comment:3 Changed 4 years ago by Aram Dermenjian

Commit: 9c349e3624ebaa6e677c55c0ee6bf47388236ce4
Description: modified (diff)

New commits:

46846d4Add sagetex support
9c349e3Merge branch 'sagetex' into t/27543/definitions_and_commands_in_sagetex

comment:4 Changed 3 years ago by git

Commit: 9c349e3624ebaa6e677c55c0ee6bf47388236ce4390dcf2fc427a12d8bc9b3146af08b7501622f32

Branch pushed to git repo; I updated commit sha1. New commits:

390dcf2Merge branch 'develop' into t/27543/definitions_and_commands_in_sagetex

comment:5 Changed 3 years ago by Aram Dermenjian

Status: newneeds_review

comment:6 Changed 3 years ago by git

Commit: 390dcf2fc427a12d8bc9b3146af08b7501622f3249c4eb29cdb020010417785d63e24d3c0818e6f9

Branch pushed to git repo; I updated commit sha1. New commits:

04c5f28pyflakes fix
49c4eb2pyflakes fixes

comment:7 Changed 3 years ago by git

Commit: 49c4eb29cdb020010417785d63e24d3c0818e6f92b9ca1b0bc1b9194c290894ddb1926198316ea8e

Branch pushed to git repo; I updated commit sha1. New commits:

2b9ca1bMinor documentation updates

comment:8 Changed 3 years ago by git

Commit: 2b9ca1b0bc1b9194c290894ddb1926198316ea8e4ea49f83a0db04d1d3102804d1fd7dec4930bfc0

Branch pushed to git repo; I updated commit sha1. New commits:

4ea49f8Doc fixes

comment:9 Changed 3 years ago by Erik Bray

Milestone: sage-8.8sage-8.9

Moving tickets from the Sage 8.8 milestone that have been actively worked on in the last six months to the next release milestone (optimistically).

comment:10 Changed 3 years ago by git

Commit: 4ea49f83a0db04d1d3102804d1fd7dec4930bfc01f9324ff592fc2f9e7fb938cd82f2a50eb7cf271

Branch pushed to git repo; I updated commit sha1. New commits:

faf17a0Merge branch 'develop' into t/27543/definitions_and_commands_in_sagetex
1f9324fRemove lazy_import

comment:11 Changed 3 years ago by Aram Dermenjian

Status: needs_reviewneeds_work

comment:12 Changed 3 years ago by git

Commit: 1f9324ff592fc2f9e7fb938cd82f2a50eb7cf271dedc3560b15dd2293e612b15331b62ae794b12c0

Branch pushed to git repo; I updated commit sha1. New commits:

dedc356Without lazy import, can't build

comment:13 Changed 3 years ago by Erik Bray

Milestone: sage-8.9sage-9.1

Ticket retargeted after milestone closed

comment:14 Changed 2 years ago by Matthias Köppe

Milestone: sage-9.1sage-9.2

Moving tickets to milestone sage-9.2 based on a review of last modification date, branch status, and severity.

comment:15 Changed 2 years ago by Matthias Köppe

Milestone: sage-9.2sage-9.3

comment:16 Changed 20 months ago by Matthias Köppe

Milestone: sage-9.3sage-9.4

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

comment:17 Changed 14 months ago by Matthias Köppe

Milestone: sage-9.4sage-9.5

Setting a new milestone for this ticket based on a cursory review.

comment:18 Changed 9 months ago by Matthias Köppe

Milestone: sage-9.5sage-9.6

comment:19 Changed 5 months ago by Matthias Köppe

Milestone: sage-9.6sage-9.7

comment:20 Changed 5 months ago by Frédéric Chapoton

Milestone: sage-9.7sage-wishlist
Note: See TracTickets for help on using tickets.