sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.39k stars 473 forks source link

Definitions and commands in sagetex #27543

Open thecaligarmo opened 5 years ago

thecaligarmo commented 5 years ago

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.

Component: packages: standard

Keywords: sagetex

Author: aram.dermenjian

Branch/Commit: u/aram.dermenjian/definitions_and_commands_in_sagetex @ dedc356

Issue created by migration from https://trac.sagemath.org/ticket/27543

thecaligarmo commented 5 years ago

Description changed:

--- 
+++ 
@@ -1 +1,26 @@
+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 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.
thecaligarmo commented 5 years ago

Changed keywords from none to sagetex

thecaligarmo commented 5 years ago

Author: aram.dermenjian

thecaligarmo commented 5 years ago

Branch: u/aram.dermenjian/definitions_and_commands_in_sagetex

thecaligarmo commented 5 years ago

Commit: 9c349e3

thecaligarmo commented 5 years ago

New commits:

46846d4Add sagetex support
9c349e3Merge branch 'sagetex' into t/27543/definitions_and_commands_in_sagetex
thecaligarmo commented 5 years ago

Description changed:

--- 
+++ 
@@ -17,7 +17,7 @@
 }

-This is normally ok except that in \newlabel we can't have \def\lr#1 (in particular we need ##1 instead of #1) +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.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 9c349e3 to 390dcf2

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

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

390dcf2Merge branch 'develop' into t/27543/definitions_and_commands_in_sagetex
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

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

04c5f28pyflakes fix
49c4eb2pyflakes fixes
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 390dcf2 to 49c4eb2

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 49c4eb2 to 2b9ca1b

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

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

2b9ca1bMinor documentation updates
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

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

4ea49f8Doc fixes
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 2b9ca1b to 4ea49f8

embray commented 5 years ago
comment: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).

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

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
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 4ea49f8 to 1f9324f

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 1f9324f to dedc356

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

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

dedc356Without lazy import, can't build
embray commented 4 years ago
comment:13

Ticket retargeted after milestone closed

mkoeppe commented 4 years ago
comment:14

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

mkoeppe commented 3 years ago
comment:16

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

mkoeppe commented 3 years ago
comment:17

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