bird-team / brisbane-bird-atlas

Atlas of the Birds of Brisbane: Community bird atlas for Brisbane, Australia
https://brisbanebirds.com
GNU General Public License v3.0
3 stars 0 forks source link

Formatting of Grey Goshawk text onward broken #130

Closed Louis-Backstrom closed 5 years ago

Louis-Backstrom commented 5 years ago

The book still builds at the moment, so I've been making edits to the body of the Atlas so that we don't just stop progress while we're trying to resolve #129. Oddly, every species in the book from Grey Goshawk onward is centre aligned rather than justified, and there's some other funky markdown (or tex?) stuff happening too:

image

I will attempt to resolve this by working out what about the GG text is different, but putting this up here in case I can't work it out.

Louis-Backstrom commented 5 years ago

This is fixed in 79075e6. Initially I'd put Rmd italics ("Accipiter") in the caption, which for whatever reason had sent the formatting all wonky in tex. Currently Accipiter is just left as is in the caption, but I'd like to italicise it (or non-italicise it, seeing as the whole caption is italicised) somehow still. Closing this for now, but if @jeffreyhanson has any ideas on how to do that without breaking either the website or the book?

jeffreyhanson commented 5 years ago

Hmm, you might have to escape the " symbols, i.e. put \" instead

Louis-Backstrom commented 5 years ago

wouldn't escaping the _ just present the text as _Accipiter_ instead of Accipiter?

(Probably should have clarified, I don't want inverted commas, I just want italicised text (as per genus name conventions), but using markdown's standard underscore notation breaks the formatting as the caption is nested within a function)

jeffreyhanson commented 5 years ago

Oh right - yes, I misunderstood - sorry. The problem is that the atlas manually handles the formatting of the text in the captions to ensure consistency between the pdf and the website. That is, it actually writes the html and latex code, instead of relying on pandoc to do the conversion (which is what happens for most other text in the atlas), and so markdown syntax doesn't actually apply. So, I would need to update the https://github.com/bird-team/brisbane-bird-atlas/blob/master/code/functions/render_species_profile.R file so that it can recognise basic markdown formatting. This is not trivial - but I agree that it's important to add this functionality.

Louis-Backstrom commented 5 years ago

Alright, that sounds like a low priority issue - I'll reopen this but hibernate it so we can come back to it later.

Louis-Backstrom commented 5 years ago

Tried a bunch of different attempts at a simple solution to no avail - it seems like it'll have to be a deeper change in the underlying code to get the functionality.

jeffreyhanson commented 5 years ago

I've just pushed an attempt to support italics/bold text in the captions. Let's see if it works when the pdf finishes rebuilding. Note that it assumes that all underscores and asterisks have spaces around them (e.g. this is regular text, _this is italics text_ . In other words, starting italics/bold text mid-word (e.g.regulartextitalicstext`) will cause problems.

Louis-Backstrom commented 5 years ago

Hmmm, this doesn't seem to have worked:

image

and neither on the website:

image

What's more, the formatting of the rest of the text in the book appears to be kinda broken - I don't know how new/old this is but I think we want justified text in the columns (not center aligned) and left aligned text in the titles? image

jeffreyhanson commented 5 years ago

Ok - thanks for checking this. I've just pushed another attempt at fixing this - let's see if it works when the rebuild finishes.

Yeah - that formatting isn't right, I don't know why that's happened. Let's see if it persists.

jeffreyhanson commented 5 years ago

It looks like the formatting issue in the pdf is caused by a % symbol in the caption (note this doesn't affect % symbols in the main text of an Rmarkdown document). This is because % symbols are treated as comments in Latex, meaning that the following text these symbols are ignored which can cause issues. I'll update the code so that it automagically handles % symbols correctly.

jeffreyhanson commented 5 years ago

Also, I just realised the text for figure captions are formatted to be italics. So if the code for specifying italics is working then we won't actually notice any difference since the whole caption, including the text we manually specify as italics, will be italics.

jeffreyhanson commented 5 years ago

Yeah, it looks like the text justification/formatting issue was fixed by 2691b30.

Louis-Backstrom commented 5 years ago

Is it possible to make it such that "double italicising" (ie "italics" inside the caption) reverts back to normal text? This seems to be the convention elsewhere when writing species names and the like - could we achieve that here easily?

I seem to recall from my brief experiments with latex that instead of "italicising" text you can emphasize it (or something similarly named), and one level of emphasis is italics but two levels is normal text? Or something?

jeffreyhanson commented 5 years ago

IIRC the convention for species/taxonomic names in paragraphs of italics text is to underline them. However, markdown doesn't have any syntax for underlines so we would have to invent something using characters we don't think we would ever use in normal text (e.g. $$this sentence is underlined$$, or @@this sentence is underlined@@). What do you think? Do you have any ideas for which character we should reserve for underlining text?

Louis-Backstrom commented 5 years ago

maybe ||this sentence is underlined|| ? It doesn't really matter too much, I doubt we'll use double symbols very much ever.

jeffreyhanson commented 5 years ago

Yeah good idea - I'll try and implement this today.

jeffreyhanson commented 5 years ago

Ok, I'm closing this now because we have underlining in both the pdf and html versions of the atlas (https://brisbanebirds.com/grey-goshawk-accipiter-novaehollandiae.html#grey-goshawk-accipiter-novaehollandiae).

Louis-Backstrom commented 5 years ago

Looks fantastic, thanks Jeff