Subject: mailing-list for TeXmacs Users
List archive
From : "Bill Eaton" <address@hidden>- To: <address@hidden>
- Subject: RE: [TeXmacs] Fwd: Re: Image Inclusion (aka inline plots)
- Date: Fri, 24 May 2013 14:23:17 -0700
David's technique should work OK. I wasn't aware that you could squeeze in a
figure in the middle of a session like that.
Miguel de Benito Delgado has pointed out an additional refinement of David's
technique, which is that if you happen to make changes to your EPS file, you
can update the linked image by using Tools...Update...Image Links menu item.
For the sessions that support it (Octave, Python, and possibly Matlab),
inline figures remain attractive and possibly less work for an interactive
math environment.
For the sessions that don't yet support it (most notably Maxima), David's
technique might be the only game in town.
--Bill Eaton
On 5/24/2013 3:20 AM, Andrea Gamba wrote:
> Hello, I am routinely using the ps_out() method to get inline figures
> with scipy and the python plugin.
>
> The figures I obtain are by default much larger than the width of the
> page, so I have to manually resize them one by one.
>
> Is it possible to use ps_out() with an argument specifying the size of
> the inline figure, or is there any optimal way to produce an inline
> figure of desired size?
>
> Andrea Gamba
>
Hi Andrea:
You should have received a reply from Bill Eaton concerning your message
related to inline image inclusion.
I think he is spot on in this matter. The ps_out() method is not a
feature of TeXmacs. It is a feature of the
Python plugin code. It slots an EPS file into the Python session space
of a TeXmacs document. There are no
arguments to this method that I know of to "re-size" the file if it is
too big for the real estate of the session.
It is up to the user to to generate the the EPS file by whatever means
so that it is of the desired dimensions.
Evidently there is some interest in having this capability. I am not
sure exactly what is driving the need for this
feature, but I presume that there must be one or more reasons why users
want to do this.
However, having said that, the built-in image inclusion tools of TeXmacs
are much better in general for this
purpose. You do not have to use the ps_out() function to insert an
image into the Python session space of
a TeXmacs document. If instead you use the built-in image inclusion
methods of linking or inserting images
then you will be able to re-size to your heart's content.
There are two ways to do this:
1. Between and two lines of a TeXmacs Python session with the cursor in
the session and the session in focus,
use the Focus --> Insert text field above (or Insert text field below,
according to where you want to insert the image)
and with that TeXmacs inserts a TeXmacs text area between the line of
the session input and output. This area can be use
like any TeXmacs area outside the session -- for text, mathematical
expressions, and images. I have not tried tables,
but it would not surprise me if these work also. However, the current
Python session is still active. Just be sure to
leave at least one Python] session prompt at the bottom so that you can
continue to enter more expressions after
the text area. You can slot these text areas in at any time. By this I
mean you could enter all the Python expressions
of the session and the go back and insert the text areas between the
Python input and output lines. Or you could do
this as you go one line at time. Personally, I like the first method.
Mistakes are easier to fix.
2. With the TeXmacs cursor in a text area, use one the following menu items:
- Insert --> Image --> Big figure or
- Insert --> Image --> Small figure
the difference being a matter of choice. Big figure is big and centered
and Small figure is small and left justified by default.
You will have to experiment to see which suits your needs. Either of
these inserts a figure area into the TeXmacs text area
of your session. Now move the cursor so that the Big or Small figure
area is in focus.
3. Then choose one of the following menu items:
- Insert --> Image --> Link image ... or
- Insert --> Image --> Insert image ...
the difference being whether or not you want your image file linked to
the TeXmacs document or included.
I recommend linking images files. If you are going to print the TeXmacs
document or export to PDF, the result
will be the same in both cases. However, by linking, changes to the
images will flow through, and if inserted
this does not occur. Even if you are going to distribute the TeXmacs
document itself, linking will work. Merely
create a folder for your TeXmacs document, and a sub-folder within that
folder for all the images and then
link them from there. Then tar and gzip (.tgz or whatever) the folder
containing the TeXmacs document and
image folder and use the resulting archive file for distribution. Keep
in mind that an exported PDF file should
be noticeably smaller.
Or, you can skip step 2 and merely insert or link the image file in the
TeXmacs session text area using one
of step 3. If you do that you can change the alignment of the image
using one of the
- Format--> Paragraph-Alignment-- Left aligned | Center | Right aligned
menu selection items. This would result in what is most like what has
been called "inline" image insertion.
In any case when the image is inserted you will see that if the image is
in focus, it may be sized according
to your needs. There are ways to do both absolute (e.g., 3.5in , 7.8cm)
and relative (e.g., 0.7par) sizing of images.
It is usually only necessary to re-size using the width. Refer to the
TeXmacs documentation for more information
about the available absolute and relative parameters and units that can
be used for the width and height of
images. Merely enter your Width: (and/or Height:) parameter using the
window in the appropriate slot
that appears at the top of the page in the focus area below the menu
items and icons bar. This can also be
accomplished using similar entries from the file selection dialog window
that appears for selecting the file to
be linked or inserted.
In my opinion, this is the best way to include images "inline" in a
TeXmacs plugin session. This works for other sessions
such as Maxima and Octave also. In fact it should work for any session
that allows the insertion of a text area
between session input and output lines. Additionally, text and
mathematical expression may be entered in the
text area either above or below the image or in the figure title -- for
Big figure and Small figure. The image can also
be aligned as desired. This is not possible with ps_out() as far as I know.
Attached is a PDF file that is the article some of the image inclusion
issues relevant to TeXmacs. In particular this article
was motivated by the problem of images that had "transparency" effects.
However, whether or not this is an issue,
the article contains information that I believe is useful in general
with respect to TeXmacs image inclusion.
Now this may all sound really complex, but once you go through this by
experimenting with a practice TeXmacs
file and some typical image files you will see how easy this really is.
Lastly, I cannot say this too many times --
always, always, always use EPS and if you cannot then convert whatever
you have to EPS. This will save you a ton
of headaches. If you must use ps_out() for some reason then create your
EPS files to the size you require for the
document. The attached article may help you for re-sizing EPS files and
converting others to EPS.
Long message = complete answer I hope.
Best wishes,
David E. Miller
- [TeXmacs] Fwd: Re: Image Inclusion (aka inline plots), David E. Miller, 05/24/2013
- RE: [TeXmacs] Fwd: Re: Image Inclusion (aka inline plots), Bill Eaton, 05/24/2013
Archive powered by MHonArc 2.6.19.