Pages

Thursday, April 22, 2021

Making your own album 14

click the 'Documents' header to see previous entries
https://rainbowstampsandcoins.blogspot.com/search/label/documents

4.2     More possibilities to align texts (2 B)

4.2.1     Page_text

4.2.1.1     Basic code

In module 1 A we already saw the command ‘Page_text_Centre’ to put text on the pages.

Parameters ware : font and size, and the desired text placed between two pairs of double (straight) quotes “ text
This command looks like : PAGE_TEXT_CENTRE (HN 10 “free text”)
Parameters are always placed between round brackets, and the free text placed between two pairs of double straight quotes.

When we only  use ‘PAGE_TEXT’, the quoted text will be aligned left, and when we choose ‘PAGE_TEXT_RIGHT’ it will be aligned right.

Open test design 5b, and save it as ‘test design 6’, copy the codes below what is programmed already, it will create a second page:

# ------------------------------------------------------------------------------
# a second page
# ------------------------------------------------------------------------------

PAGE_START

PAGE_TEXT_CENTRE (HB 12 "\nAligning horizontally.")

PAGE_TEXT (HN 10 "This text is align to the left, this is the default setting.\nBelow is a horizontal line, that \ndoens’t leave any space at the margins, and so coverst the full width of the page.\nThe line comes directly under the text, but will appear 6 mm below the tekst, as a result of \nthe default settings in the ALBUM_PAGES_SPACING command at the beginning of our page.\n")

PAGE_RULE_H (0.1 0)

PAGE_TEXT_CENTRE (HN 10 "Here, the text is centered, because we use Page_text_Centre. Below the text is a horizontal line, \nnot leaving any space at the margins. \nThis line is placed 12 mm below the last text, but will appear 18 mm below the tekst, as a result of the \n6 mm in the settings in the ALBUM_PAGES_SPACING command at the beginning of the page.\n")

PAGE_RULE_H (0.1 12)

PAGE_TEXT_RIGHT (HN 10 "Here, the text is aligned to the right, as a result of the Page_text_right command.\nThe line underneath is now 8 mm away from the margins, and because of the negative value in the parameter, \nit will appear 4.5 mm higher than the 6 mm from the \nALBUM_PAGES_SPACING command in the beginning of the page.")

PAGE_RULE_H (0.1 -4.5 8)

Using copy-paste, will work perfectly. If you prefer to type all commands and texts yourself, make sure to type all of above continously i.e. without using ‘enter’ or ‘ctrl + enter !!)

The result should look as follows :

Basic rule is that the command should look as follows:

Page_Text (HB 12 “free text”)   code with parameters between round brackets
Page_Text (HB 12 “free text”)    within the round brackets, font and size
Page_Text (HB 12 “free text”)   within the 3rd pm, free tekst starting and ending with double straight quotes.

To split lines use the command \n, within the quoted text
Page_Text (HB 12 “free \ntext”)

4.2.1.2     Making visual changes in your programming code

What follows will have no influence on the final result of  your album, but it might be interesting if you want to have a more visual overview of your programming code. But be careful, as it can easily lead to unexpected errors !

The code below shows the same programming code as in the previous exercise, but it is  presented in another, more visual way :

It surely looks nicer, it refers to what the result on the album page will look like, but …
It all depends on the size of your screen, as the same layout, suddenly looks totally different, when using a smaller window ….


The same code, on a smaller window, is suddenly not that visually attractive anymore.

If you feel like testing it, make sure to stick tot he rules within the ”free text”

Always start programming as shown in 4.2.1.1.
While inserting the texts, type in a continuous way, as if it you were typing a full text between the double quotes. If you want to ‘force’ a new line in your programming code, then end this programming line with a double quote, as if you would end the “free text” part, “,  type a back slash,\ and now start the new command lne with an ‘opening’ double set of quotes  . Don’t forget, what follows needs to end in double quotes too!

It will look like :

Page_text (HN 10 “Here is the first part of the free tekst” \
“followed by the rest, but on another line”)

For the program, both lines are connected, as if they were on one single line.
Now you can add a tab before the double quotes on the second line, for the visual effect.
Using the same strategy, you can now add more visually separated lines to your program.

For the result on your PDF, this technique will not make any difference. No empty line, no new line will be created this way!

If you feel the urge to create an empty line in your programming code – within the “free text” area, you will need to work in the same way :


Pressing ‘enter’ to make a blanc line, within the “free text” command will result in an error!

Error in line 66: Bad line continuation.

It surely asks for some concentration to give your programming code a visual layout.
And even then, it all depends on the way your screen, window is set up.
Make sure to work like the method in 4.2.1.1 in the beginning.
Especially if you prepare codes in a word processor first, and use copy-paste to add them in AlbumEasy 4.2.1.  Visual layout in the programming has NO effect on the end result.

This and other error codes will be rehearsed at the end of the course.

Finally click Generate and PDF, to see the result of the aligning:

to be continued ... 

previous part : https://rainbowstampsandcoins.blogspot.com/2021/04/making-your-own-album-13.html
next part : https://rainbowstampsandcoins.blogspot.com/2021/04/making-your-own-album-15.html

No comments:

Post a Comment