Ethics [ed: George Matthews]

Hi @apurva–I was trying this trick for internal links in the book so they wouldn’t repeat in parentheses:

For example, in the “What is an Open Textbook” section in the Philosophy of Mind book, there is an internal link at the end of the first paragraph, in parentheses. It shows up in the print PDF not as a link URL but as an internal bookmark I think, with just a hashtag symbol and the last part of the URL:

When I try to give that internal link a class="reference" tag it isn’t working to make it avoid printing the bookmark in parentheses. I’m guessing this is because of some way in which internal links are handled differently? I found it surprising because if you go to the “text” view of that section in the PB interface it gives a full URL:

“(please see <a class="reference" href="https://press.rebus.community/intro-to-phil-of-mind/back-matter/licensing-and-attribution-information/">the licensing information for this book</a> for more information).”

This isn’t a big deal or a need for a rush, but it does look a little strange on the print versions I think. Thanks for any thoughts you have about this!

Hi Christina, I’ve taken a look at a new print PDF export, and don’t see the links repeated in parentheses. I think ensuring that the URL in the hyperlink is the full URL, not just partial, like a bookmark, will help. I tested adding the class="reference" tag to the internal link in the ‘How to Use the Book’ section, and found that it worked perfectly to not list out the full URL in the print PDF file (note that in the digital PDF, the text would still be hyperlinked).

Could you possibly look at a new print PDF export and see if you’re still seeing this issue crop up? If so, I can have a look at the specific chapters where you might be noticing the discrepancy.

Hi @apurva–finally getting back to this after a couple of months dealing with lots of work in my other job related to the pandemic. I have a small breather now and am getting back to work on this book series!

I just went back to this issue about internal links showing up strangely on the print PDFs. Even though the full URL is in the hyperlink in the “text” field for the chapters/front matter, what gets printed in the print PDF is as noted above, just an internal bookmark. This is the case for first two front matter sections (What is an Open Textbook, and How to Use this Book), as well as internal links in Chapter 3.

I did go in and try to class-“reference” trick and that works to take the URLs out of the print version altogether. I’m not sure what I did before because now that is working fine! I did that for the internal links in the “What is an open textbook” section.

But in some cases I’d like to keep the internal URLs in there–e.g., in some chapters there are references to other chapters, and if a student just has a print version of one chapter and wants to see the URLs for the others, it would be good if they were in the print version. But again, even though I have the full URL in the chapter code, the print version just has the internal bookmark.

For example, in Chapter 3 there is this in the HTML:

For example, given an opportunity to donate to a charity, deontologists 
(see <a href="https://press.rebus.community/intro-to-phil-ethics/chapter/
kantian-deontology/">Chapter 6</a>) would consider whether there 
is an ethical rule that required them to donate. Utilitarians 
(see <a href="https://press.rebus.community/intro-to-phil-ethics/
chapter/utilitarianism/">Chapter 5</a>) would consider whether a 
donation would produce better consequences if they donated than if they did not. 

But this is what appears in the print PDF for the same sentences:

For example, given an opportunity to donate to a charity, deontologists 
(see Chapter 6 (#chapter-kantian-deontology)) would consider whether 
there is an ethical rule that required them to donate. Utilitarians (see Chapter 5 
(#chapter- utilitarianism)) would consider whether a donation would produce 
better consequences if they donated than if they did not.

And I’m not sure why that would be the case. Any thoughts? Again, this is not a big rush but it’s curious!

Hi Christina, glad you have had a bit of a breather and are able to slowly return to work on this book series! :slight_smile:

Excellent! Nothing has changed in the interim, but I’m glad that this now resolved on your end as well.

As for the internal URLs — I’ll need to reach out to the Pressbooks team to help troubleshoot, as it’s not just a matter of displaying the absolute (full) URL. As you noted, the internal links are converted to bookmarks or anchors. The shorter internal links are preferred for the web version, especially if you’re linking between chapters, but they may be converted to bookmarks for easier navigation in the digital PDF. I’ll pass this along to the Pressbooks team, and let you know if they have more to add and suggestions for how we can display the full URLs.

@christina.hendricks - good news, the Pressbooks team is currently testing out a solution to display the full URL for internal links in the print PDF. We should receive results of this testing process soon, and I’ll let you know as soon as it comes in!

That’s great–thank you for the update!

1 Like

Hi Christina, we’ve made some progress on the internal links issue. The Pressbooks team has made what’s called the data-url attribute available, which ensures the display of complete URLs (even for internal links in the book) in the print PDF file. I’ve modified our existing custom CSS for the PDF as follows from:

.print a:not(.reference)::after {
  content: " (" attr(href) ")";
}

to:

.print a:not(.reference)::after {
  content: " (" attr(data-url) ")";
}

The internal links in the book are showing up as expected, with the full URL instead of an internal bookmark! You can confirm the same in a new PDF export.

However, it looks like all other links in the book are also now being surfaced with a slight hiccup in links contained in figure captions. Some, like the “Buddha statue in Phuket” in Chapter 2 appear in the print PDF with all their relevant URLs, while others, like the “An Hindoo Woman throwing herself on the funeral pyre of her Husband” in Chapter 1 display with empty parentheticals where the URL should appear. I’m not sure why some captions contain the links while others don’t, but for the sake of expediency with this book, will suggest a quick solution:

  • Add the class="reference" to all the links in image captions (in the Text Editor)
  • Save your changes
  • Repeat for all image captions in each chapter

There’s nothing else to modify in the Custom CSS. This will ensure that the print PDF file isn’t inundated with URLs that students may not necessarily need — image source, creator’s website, and license. This text will still be displayed in the print PDF, it just won’t be hyperlinked or have the URL corresponding printed out.

Apologies for this extra step — I tried to find a way to automate/isolate this work in the CSS, but it proved a bit more complex than I had imagined, and I know we’re in a rush on this book.

Let me know if you have any questions. Once this is done, we should be ready to get the book in print!

@clhendricksbc — following up my long-winded email with much better news. We’ve figured out a custom CSS option to eliminate the empty parenthetical after links in captions. So to summarize:

  • URLs will be printed in the print PDF, with the exception of:
    • Links tagged with the class reference
    • Links contained inside image captions

All that’s left before we move into POD is for you to do a final look through of the print PDF.

Thank you, @apurva! This is good news.

I just did a new export of the print PDF, and found some more empty sets of parentheses. I’m not sure if there was something I needed to do to avoid these! They are all external links.

There’s one on the license page (p. 4), where the CC BY license is linked in the digital PDF last line, below):

And in the Acknowledgements, p. 16:

In “About the Contributors,” p. 109 (last line):

Also the iframes for google forms on pp. 110 & 111.

And all throughout pp. 112 & 113 (licensing information), p. 115 (accessibility information), p. 117 (version history).

I’m wondering if I missed something I needed to do to avoid these issues?

Thanks for catching these, Christina. I’ve tweaked the CSS code slightly to ensure that there are no empty parenthesis in these sections:

  1. Copyright page (p. 4) - the CC BY URL is printed elsewhere in the book, so this didn’t seem as pressing to have printed out. Please let me know if I’m mistaken.
  2. Iframes on Google forms (p. 110 & 111) - the URLs to the iframe elements is still displayed in the print PDF, so with this rule, we avoid empty parentheses or alternatively, repeated URLs.

The Pressbooks team is investigating the other issues, which we’ve categorized as follows:

  1. URLs not printed in back matter sections (about the contributors, licensing information, review statement, version history, accessibility information)
  2. Outlier in Acknowledgements front matter section - Philosophy of Mind URL is not displayed

I’ll keep you posted when we have news on a fix on these 2 issues.

Lastly, I wanted to note that I’ve cleaned up some stray code in some chapters while I’ve been troubleshooting - mainly empty classes associated with paragraph tags. You can see this activity in the revision history on some chapters. If time permits, I can go through the book and quickly clean up other chapters as well.

Thank you so much, @Apurva! I’ll wait on the two items still outstanding. And thank you for cleaning up stray code. It has been on my to-do list to do that, but further down than all the other items related to the books that are still outstanding, so I haven’t gotten to it.

1 Like

Hi Christina, the 2 outstanding issues have now been resolved! I’ve confirmed this by looking at a new print PDF of the book, and will request you to do the same. I did note that for images that are linked to a URL in the book, the URL might display (as was with the case of the CC BY logo in the Licensing & Attributions information back matter). Unlinking the image ensured that the URL was not printed in the PDF.

Fingers crossed that all looks good enough to proceed with setting up the book in print-on-demand.

As for the stray code: it doesn’t seem to be affecting the layout or formatting, so getting to it whenever you can should be okay. Slow and steady with this task. :slight_smile:

Yikes…I let this one go for awhile! I just took a look at a new print PDF export and all looks good with the two earlier issues. I did a quick scan through the whole book in print PDF format and it mostly looks good. There is just one small thing on both the print and digital PDFs–Box C in chapter 2 (p. 21) has quite wide bottom padding. It looks fine on the web version, but in both PDFs it looks too wide. I thought it might be the custom textbox in the custom CSS for the PDF version, but that is for .textbox.custom, and Box C is styled as <div class="textbox__content">. So I’m thinking it might be related to something else?

Ultimately this is not a big deal, just cosmetic, though! Otherwise, everything looks good.

I just took a look at one more thing–I looked at the epub version and noticed that the boxes and image break between pages sometimes. Clearly this depends on the size of the font and the window in one’s reader, but I wonder if there is some custom CSS for the epub version we could use to address this? I think we did so for the PDF versions, if I remember correctly.

Here is a screen shot from my epub reader of part of Chapter 6, for example.

This isn’t needed for print on demand, but it would be useful to address if we can!

I’ve adjusted the padding-bottom for the textboxes from 7em to 3em, and this has significantly improved the layout of Box C in Chapter 2. The other textboxes are mostly unaffected by this change. Let me know what you think.

Images and content in the EPUB format is reflowable — so that they can conform to the shape of the ereader software/device that the reader is using. Images in the ebook are already set to avoid breaking across pages:

img {
display: inline-block;
height: auto;
margin: 0;
max-width: 100%;
padding: 0;
page-break-inside: avoid !important; }

Perhaps you were viewing an older version of the file? I’ve taken a look on iBooks and Adobe Digital Editions and found that images in general (including the one you’ve specified) do not break across pages. I’d suggest deleting any ebook files from your ereader library and device and downloading a new file to confirm.

Hi Apurva, thank you for checking! I did delete all older versions and downloaded the latest one of the Ethics book, and looking on the ibooks app on my Macbook laptop mostly it’s fine…there is one size for the window on my laptop where it still happens with that one image of Schopenhauer. If I resize the window to be smaller or larger than that it’s fine, but that for one size it still happens.

That doesn’t happen on Adobe Digital Editions…resizing the window doesn’t change the text at all…it just cuts it off if I make the window too small!

So it may just be an issue with iBooks and only with one image. I think it’s not worth trying to track down at this point!

This looks great! Thanks so much, Apurva.

1 Like

I’ve been able to replicate it at a single size on iBooks, as well. It’s an odd occurrence, so I will pass along a report to the Pressbooks team to help identify the error. As you noted, this isn’t a major issue to halt production on the book, but will be good to notify the team about!

No problem! Let me know whether we’re ready to update the PDF files for print-on-demand. :slight_smile: