Inserting Images

10 views
Skip to first unread message

Douglas Lapp

unread,
Mar 17, 2025, 5:21:37 PM3/17/25
to PreTeXt support
I am having trouble inserting images.  I have placed an image (.png file) into a folder I called "images" that is at the same level as my "source" folder.  When I use
<image source="images/file-name.png">
<shortdescription>Image Description</shortdescription>
</image>
the image does not appear, but just the Image Description and an icon for the supposed image.  Any thoughts on what I am doing wrong?  Thanks for any help.  Sorry I am such a novice at this.

Andrew Scholer

unread,
Mar 17, 2025, 5:26:40 PM3/17/25
to pretext...@googlegroups.com
Douglas - 

Your publisher file is likely pointing to a different directory than where you have placed the images.


Then check your publisher file to see where the directories element is pointing:
<directories external="../external"  generated="../gen" />

Regards,

Andrew Scholer (he/him/his)
Computer Science Instructor
Chemeketa Community College


--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-support/5e04d06f-0bdc-4761-ab06-c0621cbfe2e3n%40googlegroups.com.

David Austin

unread,
Mar 17, 2025, 5:28:10 PM3/17/25
to pretext...@googlegroups.com
I was just writing when Andrew's message came in.  You probably want your figure in the directory "external/images".

Douglas Lapp

unread,
Mar 17, 2025, 10:24:48 PM3/17/25
to pretext...@googlegroups.com
Thanks, David and Andrew. So should I create a folder called external and place a folder inside of it called images where I will place the image?  Then I assume I look in the publication file for the directory pointer and edit it to say <directories external=“../external/images”?  Right now that is set at <directories external=“../assets” as was done from the GitHub template. 

Thanks,
Doug

On Mar 17, 2025, at 5:28 PM, David Austin <david.a...@gmail.com> wrote:



Mark Fitch

unread,
Mar 17, 2025, 11:05:08 PM3/17/25
to pretext...@googlegroups.com

<directories external="../assets" can be left.

With that name make a directory called "assets". Make a sub folder inside it called images. Put your images there (so what you said but changing to "assets"). Then everything will match.

Older versions called the directory "external" so many of us still have that name and we have that in our publication files. With publication files names are but noise and smoke (and tradition).

Douglas Lapp

unread,
Mar 18, 2025, 9:39:10 AM3/18/25
to pretext...@googlegroups.com
Thanks, Mark!  I am slowly starting to understand the architecture here.  I really appreciate everyone's help as I learn!



--
______________________________________
Douglas A. Lapp, Ph.D.
Professor of Mathematics & Mathematics Education
Department of Mathematics
Central Michigan University
222 Pearce Hall
Mt. Pleasant, MI  48859
USA
Phone: 989-774-5393
Fax: 989-774-2414
Web Page: http://people.cst.cmich.edu/lapp1da/

"If you understand something in only one way,
then you don't really understand it at all."
-- Marvin Minsky
______________________________________

Douglas Lapp

unread,
Mar 18, 2025, 9:58:20 AM3/18/25
to pretext...@googlegroups.com
Hi Mark,

I tried this and am still not seeing an image appearing.  Here is what I entered:
<image source="images/descarte-fly.png" width="50%">
<shortdescription>Descarte's Fly</shortdescription>
</image>
I am using the "assets" sibling directory to the source folder that was originally created by GitHub when I used the template.  I placed a folder inside of the "assets" and placed the image inside of that folder.  I am not sure why it is not working.  Thanks for any advice.

Sean Fitzpatrick

unread,
Mar 18, 2025, 10:02:00 AM3/18/25
to pretext...@googlegroups.com

The file should be in
assets/images/descarte-fly.png

Is that what you have? If so, rebuild the HTML just to be sure.


Douglas Lapp

unread,
Mar 18, 2025, 10:09:02 AM3/18/25
to pretext...@googlegroups.com
Hi Sean.  I think that is what I have.  Here is an image of my directories.

Screenshot 2025-03-18 at 10.07.31 AM.png

Oscar Levin

unread,
Mar 18, 2025, 10:25:34 AM3/18/25
to pretext...@googlegroups.com
And could you share your publication file?  Or share a link to your GitHub repository and I can take a peek.

The next step is to look at your output folder and see if the image is in the right place.  And look at your output source to see where it is expecting the image.

Douglas Lapp

unread,
Mar 18, 2025, 10:32:36 AM3/18/25
to pretext...@googlegroups.com
Thanks, Oscar.  Sorry for being such a pain.  I appreciate the help.  Here is a link to the repository

Here is the codespace


Douglas Lapp

unread,
Mar 18, 2025, 11:03:02 AM3/18/25
to pretext...@googlegroups.com
Hi Oscar.  Nevermind.  I got it to work.  I had a typo on the file name.  Sorry for the bother.  BTW, when you go up for promotion and want a letter of support, I am your guy.  What you contribute to the community really is an asset to all of us!!!  Thank you for being there when we novices need it.

Cheers,
Doug

Oscar Levin

unread,
Mar 18, 2025, 12:48:06 PM3/18/25
to pretext...@googlegroups.com
Glad it's working. And these sorts of "bothers" are really helpful to know where the pain points are and how we can support new authors better. 

Reply all
Reply to author
Forward
0 new messages