-
I posted to worthyisthelamb.info
http://worthyisthelamb.info/blog/rss.xml
worthyisthelamb.info
<start rant>Part of the reason Apple is popular is because their stuff is intuitive and easy to use. You can get started doing basic things on a Mac without a manual — that’s one of the reasons people love them. Mind you I’m not an Apple fan — I don’t even own an Ipod. But I do know an intuitive and easy-to-use interface when I see one. Linux fanboys often don’t understand that. They confuse “graphical interface” with “easy-to-use.” No, intuitive is something you can pick up naturally. A GUI isn’t necessary in order to be intuitive and easy to use. Having said that, margins in ConTeXt</end rant> <!--break--> As far as I can tell, margins in ConTeXt are set by (1) defining the size of the text area and then (2) setting the location of the text area with topspace and backspace. Here’s a picture (figure 3.1 from the user manual):
In other words, you set the bottom and right margins INDIRECTLY.
Setup
Use US letter size
First things first, let’s change the paper size:
\setuppapersize[letter]
Draw margin lines for debugging
Next, have ConTeXt draw margin lines so you can see that everything is working:
\showframe
Put that command anywhere on a line by itself before \starttext.
Equal Margins
Equal margins is the easiest scenario.
Equal top and bottom margins
Ex: Equal 1 inch top and bottom margins
\setuplayout[topspace=1in,height=middle,location=middle]
topspace=1in tells ConTeXt to use a 1 inch top margin.
height=middle expands the text area so that the top and bottom margins are equal.location=middle — By default, it seems that ConTeXt does not center the print area on the page. Leave this option out and the printed page will not be centered. ( By the way: that’s the page printed as a whole, not the text.)
Note: If you’re not using \showframe and it seems that the bottom margin isn’t working, that’s because ConTeXt is drawing an empty footer. Use \showframe to see what I’m talking about. Add footer=0in to setuplayout to make the footer go away.
Equal left and right margins
Ex: Equal 1 inch left and right margins
\setuplayout[backspace=1in,width=middle,location=middle]
backspace=1in tells ConTeXt to use a 1 inch left margin. width=middle expands the text area so that the left and right margins are equal.
location=middle — see above.
Note: If you have \showframe enabled, you’ll notice extra vertical bars in the left and right margins. That’s the area for margin notes. More on that later. Ignore these if you’re not using margin notes.
Using these options all together:
\setuplayout[ topspace=1in, height=middle, backspace=1in, width=middle, location=middle ]
Unequal Margins
You’re gonna have to take out a calculator for this.
Ex: 1 inch top margin, 0.5 inch bottom margin, on US LETTER
\setuplayout[topspace=1in, height=9.5in, location=middle]
topspace=1in sets a 1 inch top margin. location=middle — see the explanation in equal top and bottom margins above.
height=9.5 sets a 9.5 inch tall text area, resulting in a 0.5 inch bottom margin. You don’t set the bottom margin directly — it’s the difference of the the top margin and the text height. (Draw yourself a picture if you don’t understand this.)
For US LETTER:
The total size of the page is 11 inches.
Since the top margin is 1 inch and we want the bottom margin to be 0.5 inches, the text height has to be 11 – 1 – 0.5 or 9.5 inches.
Like I said before, margins in ConTeXt are confusing. There is a variable bottomspace that supposedly sets the bottom margin, but it doesn’t do anything on my version of ConTeXt.
Ex: 1 inch left margin, 0.5 inch right margin, on US LETTER
\setuplayout[backspace=1in, width=7in, location=middle]
backspace=1in sets the left margin to be 1 inch
width=7in sets the text width to be 7 inches, resulting in a 8.5 – 1 – 7 or 0.5 inch right margin on US LETTER. (The total width of the page is 8.5 inches; the left margin is 1 inch; the desired right margin is 0.5 inches; therefore, the text width has to be 8.5 – 1 – 0.5 or 7 inches.)
Margin Notes
To set margin notes, use the confusingly named leftmargin, rightmargin, leftmargindistance, and rightmargindistance. Again, these do NOT set the left and right margins — they set the width of margin notes.
Here’s a diagram where LM = leftmargin, LMD = leftmargindistance, etc:
|total page width _________________________________________________________________| |__backspace ______________________| |__Actual L margin|LM|LMD|text width|RMD|RM|Actual R margin|
As you can see from the diagram, the left margin note (LM) lives in the backspace. That’s why you need to set the backspace large enough to contain the margin note. leftmargindistance (LMD) is the gap between the leftmargin and the text. rightmargindistance (RMD) is similar.
Ex: 1 inch left margin, 1 inch left margin note, 0.1 inch gap between note and text
\setuplayout[ backspace=2.1in, leftmargin=1in, leftmargindistance=0.1in, location=middle] \showframe
\starttext \inleft{I'm in the left margin!} \stoptextThe backspace is 2.1 inches The left margin (note) is 1 inch with 0.1 inch gap. The actual left margin is 2.1 – 1 – 0.1 or 1 inch.
Ex: 1 inch right margin, 1 inch right margin note, 0.1 inch gap between note and text
As far as I can tell you can’t actually do this unless you also specify the left margin. Let’s use a left margin of 1 inch. You also need to know the paper size for calculations. Let’s use US LETTER with a 8.5 inch width:
\setuplayout[ backspace=1in,
width=5.4in, rightmargindistance=0.1in, rightmargin=1in, location=middle] \showframe
\starttext \inright{I'm in the right margin!} \stoptextbackspace=1in sets a 1 inch left margin. width=5.4in sets a 5.4 inch text width. (1 + text width + 0.1 + 1 + 1 = 8.5) rightmargindistance=0.1in sets the gap between the text and the right margin note to 0.1 inches. rightmargin sets the margin note to be 1 inches.
With these settings, the right margin is 1 inch.
http://worthyisthelamb.info/blog/sites/default/files/PageMarginsinConTeXtMadeEasy_E3A5/mozscreenshot3_thumb.jpg
Array ( [title] => Page Margins in ConTeXt Made Easy [permalink] => http://worthyisthelamb.info/blog/content/page-margins-context-made-easy [content] =>
<start rant>Part of the reason Apple is popular is because their stuff is intuitive and easy to use. You can get started doing basic things on a Mac without a manual — that’s one of the reasons people love them. Mind you I’m not an Apple fan — I don’t even own an Ipod. But I do know an intuitive and easy-to-use interface when I see one. Linux fanboys often don’t understand that. They confuse “graphical interface” with “easy-to-use.” No, intuitive is something you can pick up naturally. A GUI isn’t necessary in order to be intuitive and easy to use. Having said that, margins in ConTeXt</end rant>
<!--break-->
As far as I can tell, margins in ConTeXt are set by (1) defining the size of the text area and then (2) setting the location of the text area withtopspaceandbackspace. Here’s a picture (figure 3.1 from the user manual):
In other words, you set the bottom and right margins INDIRECTLY.
Setup
Use US letter size
First things first, let’s change the paper size:
\setuppapersize[letter]Draw margin lines for debugging
Next, have ConTeXt draw margin lines so you can see that everything is working:
\showframePut that command anywhere on a line by itself before
\starttext.Equal Margins
Equal margins is the easiest scenario.
Equal top and bottom margins
Ex: Equal 1 inch top and bottom margins
\setuplayout[topspace=1in,height=middle,location=middle]topspace=1intells ConTeXt to use a 1 inch top margin.height=middleexpands the text area so that the top and bottom margins are equal.
location=middle— By default, it seems that ConTeXt does not center the print area on the page. Leave this option out and the printed page will not be centered. ( By the way: that’s the page printed as a whole, not the text.)
Note: If you’re not using
\showframeand it seems that the bottom margin isn’t working, that’s because ConTeXt is drawing an empty footer. Use\showframeto see what I’m talking about. Addfooter=0intosetuplayoutto make the footer go away.Equal left and right margins
Ex: Equal 1 inch left and right margins
\setuplayout[backspace=1in,width=middle,location=middle]backspace=1intells ConTeXt to use a 1 inch left margin.width=middleexpands the text area so that the left and right margins are equal.
location=middle— see above.
Note: If you have
\showframeenabled, you’ll notice extra vertical bars in the left and right margins. That’s the area for margin notes. More on that later. Ignore these if you’re not using margin notes.Using these options all together:
\setuplayout[ topspace=1in, height=middle, backspace=1in, width=middle, location=middle ]Unequal Margins
You’re gonna have to take out a calculator for this.
Ex: 1 inch top margin, 0.5 inch bottom margin, on US LETTER
\setuplayout[topspace=1in, height=9.5in, location=middle]topspace=1insets a 1 inch top margin.location=middle— see the explanation in equal top and bottom margins above.
height=9.5sets a 9.5 inch tall text area, resulting in a 0.5 inch bottom margin. You don’t set the bottom margin directly — it’s the difference of the the top margin and the text height. (Draw yourself a picture if you don’t understand this.)
For US LETTER:
- The total size of the page is 11 inches.
- Since the top margin is 1 inch and we want the bottom margin to be 0.5 inches, the text height has to be 11 – 1 – 0.5 or 9.5 inches.
Like I said before, margins in ConTeXt are confusing. There is a variable
bottomspacethat supposedly sets the bottom margin, but it doesn’t do anything on my version of ConTeXt.Ex: 1 inch left margin, 0.5 inch right margin, on US LETTER
\setuplayout[backspace=1in, width=7in, location=middle]backspace=1insets the left margin to be 1 inch
width=7insets the text width to be 7 inches, resulting in a 8.5 – 1 – 7 or 0.5 inch right margin on US LETTER. (The total width of the page is 8.5 inches; the left margin is 1 inch; the desired right margin is 0.5 inches; therefore, the text width has to be 8.5 – 1 – 0.5 or 7 inches.)
Margin Notes
To set margin notes, use the confusingly named
leftmargin,rightmargin,leftmargindistance, andrightmargindistance. Again, these do NOT set the left and right margins — they set the width of margin notes.Here’s a diagram where LM = leftmargin, LMD = leftmargindistance, etc:
|__total page width _________________________________________________________________| |__backspace ______________________| |__Actual L margin__|__LM__|__LMD__|__text width__|__RMD__|__RM__|__Actual R margin__|As you can see from the diagram, the left margin note (LM) lives in the backspace. That’s why you need to set the backspace large enough to contain the margin note.
leftmargindistance(LMD) is the gap between the leftmargin and the text.rightmargindistance(RMD) is similar.Ex: 1 inch left margin, 1 inch left margin note, 0.1 inch gap between note and text
\setuplayout[ backspace=2.1in, leftmargin=1in, leftmargindistance=0.1in, location=middle] \showframe \starttext \inleft{I'm in the left margin!} \stoptextThe backspace is 2.1 inches The left margin (note) is 1 inch with 0.1 inch gap. The actual left margin is 2.1 – 1 – 0.1 or 1 inch.
Ex: 1 inch right margin, 1 inch right margin note, 0.1 inch gap between note and text
As far as I can tell you can’t actually do this unless you also specify the left margin. Let’s use a left margin of 1 inch. You also need to know the paper size for calculations. Let’s use US LETTER with a 8.5 inch width:
\setuplayout[ backspace=1in, width=5.4in, rightmargindistance=0.1in, rightmargin=1in, location=middle] \showframe \starttext \inright{I'm in the right margin!} \stoptextbackspace=1insets a 1 inch left margin.width=5.4insets a 5.4 inch text width. (1 + text width + 0.1 + 1 + 1 = 8.5)rightmargindistance=0.1insets the gap between the text and the right margin note to 0.1 inches.rightmarginsets the margin note to be 1 inches.
- With these settings, the right margin is 1 inch.
-
I posted to worthyisthelamb.info
http://worthyisthelamb.info/blog/rss.xml
worthyisthelamb.info
Header on the left \setupheadertexts[Left][] Header on the right \setupheadertexts[][Right] <!--break--> Header on the left and right \setupheadertexts[Left][Right] Header in the middle \setupheadertexts[Middle] Header on the left, middle, and right So far so good, right? You would think that \setupheadertexts[Left][Middle][Right] would work but it doesn’t. There are various approaches. Here’s one simple solution: \setupheadertexts[Left \hfill Middle \hfill Right] The command \hfill, also called “sticky” space, fills the left and right of the “Middle” text with equal space, resulting with the “Middle” text being placed, well, in the middle. Multi-line headers What if you want to use a header and a footer with two or more lines? In Microsoft Word, Scribus, or any WYSIWIG or pretty print environment, it’s as easy as inserting a new line in the header. However, you’ll find that, like HTML, ConTeXt turns extra whitespace and new lines into a single blankspace. For example, the following will get set on a single line: \setupheadertexts[ 1st line on L 2nd line on L ][]
Note: If you look closely, you’ll notice that “1st line…” has an extra white space in the front. That’s because the new line in the code gets turned into blank space. Multi-line headers is one area where ConTeXt, well, … sucks. Now please don’t misunderstand this as a general critique – I’m just being honest here. ConTeXt is awesome, otherwise I wouldn’t be using it, but adding multi-line headers is unnecessarily hard. Here’s how it’s done (all on a single line): \setupheadertexts[{\framed[frame=off,width=broad,align=right]{1st line on L\2nd line on L}}][]or if that’s too unreadable (and it is), use: \setupheadertexts [{\framed[frame=off,width=broad,align=right]% {1st line on L\% 2nd line on L% }}][]The % at the end of each line suppresses the extra space.Explanation: \framed adds a “box” to the header – a box that can have multiple lines. But “I don’t want a framed box” you say. That’s why frame=off turns off the border. More generally, \framed works this way: \framed[ arguments ] { text }Note that the extra curly braces { } inside the header are necessary. Also worth mentioning is align=right. “The text is on the left but why does it say ‘align=right’?” you ask. That’s really a misnomer – it stands for ragged right, which means align on the left but with a ragged right. (Similarly, align=left means align on the right but with a ragged left.) What about footers? Footers are done the same way. For example, \setupfootertexts[Left][Right] outputs a footer with text on the left and right. Different Footers and Headers for Double-Sided Pages Here’s one area where ConTeXt shines. By using two more pairs of [] brackets, you can setup headers and footers for double-sided printing like you did for normal printing. First, some necessary terminology: if you open a book, you’ll notice that pages on the right are odd (1, 3, 5, 7, …) and pages on the left are even (2, 4, 6, 8, …). That’s not a coincidence. In the typesetting world, right pages are called odd and and left pages are called even. To set different headers and footers for double-sided pages, first make sure that it’s enabled: \setuppagenumbering[alternative=doublesided]Then do the following: \setupheadertexts [L on odd page][R on odd page] % headers for odd pages [L on even page][R on even page] % headers for even pages This results in the following:
Header for page 1:
Header for page 2:http://worthyisthelamb.info/blog/sites/default/files/MiniGuidetoHeadersandFootersinConTeXt_8A02/image_thumb.png
Array ( [title] => Easy Headers and Footers in ConTeXt [permalink] => http://worthyisthelamb.info/blog/content/easy-headers-and-footers-context [content] =>
Header on the left
\setupheadertexts[Left][]Header on the right
\setupheadertexts[][Right]Header on the left and right
\setupheadertexts[Left][Right]Header in the middle
\setupheadertexts[Middle]Header on the left, middle, and right
So far so good, right? You would think that
\setupheadertexts[Left][Middle][Right]would work but it doesn’t. There are various approaches. Here’s one simple solution:\setupheadertexts[Left \hfill Middle \hfill Right]The command
\hfill, also called “sticky” space, fills the left and right of the “Middle” text with equal space, resulting with the “Middle” text being placed, well, in the middle.Multi-line headers
What if you want to use a header and a footer with two or more lines? In Microsoft Word, Scribus, or any WYSIWIG or pretty print environment, it’s as easy as inserting a new line in the header. However, you’ll find that, like HTML, ConTeXt turns extra whitespace and new lines into a single blankspace. For example, the following will get set on a single line:
\setupheadertexts[ 1st line on L 2nd line on L ][]Note: If you look closely, you’ll notice that “1st line…” has an extra white space in the front. That’s because the new line in the code gets turned into blank space.
Multi-line headers is one area where ConTeXt, well, … sucks. Now please don’t misunderstand this as a general critique – I’m just being honest here. ConTeXt is awesome, otherwise I wouldn’t be using it, but adding multi-line headers is unnecessarily hard. Here’s how it’s done (all on a single line):
\setupheadertexts[{\framed[frame=off,width=broad,align=right]{1st line on L\\2nd line on L}}][]or if that’s too unreadable (and it is), use:
\setupheadertexts [{\framed[frame=off,width=broad,align=right]% {1st line on L\\% 2nd line on L% }}][]The % at the end of each line suppresses the extra space.
Explanation:
\framedadds a “box” to the header – a box that can have multiple lines. But “I don’t want a framed box” you say. That’s whyframe=offturns off the border. More generally,\framedworks this way:\framed[ arguments ] { text }Note that the extra curly braces { } inside the header are necessary. Also worth mentioning is
align=right. “The text is on the left but why does it say ‘align=right’?” you ask. That’s really a misnomer – it stands for ragged right, which means align on the left but with a ragged right. (Similarly,align=leftmeans align on the right but with a ragged left.)What about footers?
Footers are done the same way. For example,
\setupfootertexts[Left][Right]outputs a footer with text on the left and right.Different Footers and Headers for Double-Sided Pages
Here’s one area where ConTeXt shines. By using two more pairs of [] brackets, you can setup headers and footers for double-sided printing like you did for normal printing. First, some necessary terminology: if you open a book, you’ll notice that pages on the right are odd (1, 3, 5, 7, …) and pages on the left are even (2, 4, 6, 8, …). That’s not a coincidence. In the typesetting world, right pages are called odd and and left pages are called even.
To set different headers and footers for double-sided pages, first make sure that it’s enabled:
\setuppagenumbering[alternative=doublesided]Then do the following:
\setupheadertexts [L on odd page][R on odd page] % headers for odd pages [L on even page][R on even page] % headers for even pagesThis results in the following:
[enclosures] => Array ( [0] => SimplePie_Enclosure Object ( [bitrate] => [captions] => [categories] => [channels] => [copyright] => [credits] => [description] => [duration] => [expression] => [framerate] => [handler] => [hashes] => [height] => [javascript] => js [keywords] => [lang] => [length] => [link] => [medium] => [player] => [ratings] => [restrictions] => [samplingrate] => [thumbnails] => [title] => [type] => [width] => ) ) [categories] => Array ( [0] => SimplePie_Category Object ( [term] => ConTeXt [scheme] => [label] => ) ) [tags] => Array ( [0] => ConTeXt ) [image] => http://worthyisthelamb.info/blog/sites/default/files/MiniGuidetoHeadersandFootersinConTeXt_8A02/image_thumb.png ) -
I posted to worthyisthelamb.info
http://worthyisthelamb.info/blog/rss.xml
worthyisthelamb.info
I’ve been recently playing with AucTeX and decided to give ConTeXt a try. It’s a cousin of LaTeX but for typesetters. In other words, it’s for people who want TeX/LaTeX but need something beyond the boring default look. My first impression is that it’s a really good piece of software, but… with a huge learning curve. <!--break--> The ConTeXt folk should learn from the processing project, which I’ll blog about some day. It has only about 6 tutorials but hundreds of neatly organized examples. I was able to get a working project after only reading the short tutorials and using the examples as guides.
As far as I can tell, ConTeXt is nothing like this. To make it even more frustrating, I know exactly what I want ConTeXt to do and I know that ConTeXt is quite capable of doing it but I can’t seem to find the correct documentation and/or example. Of course, I may just end up taking back everything I write here as I become more familiar with the project. What I’ll do is just go with the flow —- see where the docs take me and report back.
Oh and what I want to do is (not exhaustive list): (1) actually change fonts, other than just switching between font families, (2) using custom headers, footers, and line numbers, (3) keep item lists together on the same page, (4) use custom enumeration on lists, like (A), (B), (C), etc., not just custom symbols.
Array ( [title] => Adventures in ConTeXt [permalink] => http://worthyisthelamb.info/blog/content/adventures-context [content] =>
I’ve been recently playing with AucTeX and decided to give ConTeXt a try. It’s a cousin of LaTeX but for typesetters. In other words, it’s for people who want TeX/LaTeX but need something beyond the boring default look. My first impression is that it’s a really good piece of software, but… with a huge learning curve.
<!--break-->
The ConTeXt folk should learn from the processing project, which I’ll blog about some day. It has only about 6 tutorials but hundreds of neatly organized examples. I was able to get a working project after only reading the short tutorials and using the examples as guides.As far as I can tell, ConTeXt is nothing like this. To make it even more frustrating, I know exactly what I want ConTeXt to do and I know that ConTeXt is quite capable of doing it but I can’t seem to find the correct documentation and/or example. Of course, I may just end up taking back everything I write here as I become more familiar with the project. What I’ll do is just go with the flow —- see where the docs take me and report back.
Oh and what I want to do is (not exhaustive list): (1) actually change fonts, other than just switching between font families, (2) using custom headers, footers, and line numbers, (3) keep item lists together on the same page, (4) use custom enumeration on lists, like
[enclosures] => Array ( [0] => SimplePie_Enclosure Object ( [bitrate] => [captions] => [categories] => [channels] => [copyright] => [credits] => [description] => [duration] => [expression] => [framerate] => [handler] => [hashes] => [height] => [javascript] => js [keywords] => [lang] => [length] => [link] => [medium] => [player] => [ratings] => [restrictions] => [samplingrate] => [thumbnails] => [title] => [type] => [width] => ) ) [categories] => Array ( [0] => SimplePie_Category Object ( [term] => aucTeX [scheme] => [label] => ) [1] => SimplePie_Category Object ( [term] => ConTeXt [scheme] => [label] => ) [2] => SimplePie_Category Object ( [term] => LaTeX [scheme] => [label] => ) [3] => SimplePie_Category Object ( [term] => TeX [scheme] => [label] => ) ) [tags] => Array ( [0] => aucTeX [1] => ConTeXt [2] => LaTeX [3] => TeX ) [image] => )(A), (B), (C), etc., not just custom symbols.
Page: 1
