Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- definepapersize[BookPaperSize][
- width=8in,
- height=6in,
- ]
- setuppapersize[BookPaperSize]
- % Specify the width and height here because the inline figures need to
- % maintain aspect ratio while setting a pleasing width.
- startsetups[BookIllustrationSetups]
- setlayerframed[BookIllustrationLayer][
- frame=off,
- x=zeropoint,
- y=1.25in,
- width=makeupwidth,
- background=BookTimelineOverlay,
- ]{}
- stopsetups
- setupbackgrounds[page][
- background=BookIllustrationLayer,
- setups=BookIllustrationSetups
- ]
- definelayer[BookIllustrationLayer][
- width=paperwidth,
- height=paperheight,
- ]
- defineoverlay[BookTimelineOverlay][useMPgraphic{BookTimelineGraphic}]
- startuseMPgraphic{BookTimelineGraphic}
- % Define constants
- numeric EVENT_BEGAN, TIME_OFFSET;
- EVENT_BEGAN := 13799;
- TIME_OFFSET := 1.25in;
- PATH_THICKNESS := 2pt;
- % The book timeline title macro contains a number representing when the
- % event transpired and additional information.
- string sectionTitle, sectionTitleDigits;
- sectionTitle := "getspecificstructuretitle{3}";
- sectionTitleDigits := "";
- % Extract only digits and decimals from the book timeline title macro.
- for i = 0 upto length( sectionTitle ):
- string sectionChar;
- sectionChar := substring( i, i + 1 ) of sectionTitle;
- % A space indicates that the number has no more digits.
- if sectionChar = " ":
- break;
- fi;
- % Concatentate all the digits together.
- if ((sectionChar >= "0") and (sectionChar <= "9")) or (sectionChar = "."):
- sectionTitleDigits := sectionTitleDigits & sectionChar;
- fi;
- endfor;
- % Convert the digits from a string to a numeric value.
- numeric eventTime;
- eventTime := 0;
- for i = scantokens( sectionTitleDigits ):
- eventTime := i;
- endfor;
- numeric eventX;
- eventX := 1 - (eventTime / EVENT_BEGAN);
- % Draw the line.
- draw (TIME_OFFSET, .5*overlayheight) -- (overlaywidth, .5*overlayheight)
- withpen pencircle scaled PATH_THICKNESS;
- % Draw starting |.
- draw (TIME_OFFSET, 0) -- (TIME_OFFSET, overlayheight)
- withpen pencircle scaled PATH_THICKNESS;
- % Draw ending |.
- draw (overlaywidth, 0) -- (overlaywidth, overlayheight)
- withpen pencircle scaled PATH_THICKNESS;
- % Draw the timeline's dot relative to the event on the timeline.
- filldraw fullcircle scaled 9
- shifted(
- TIME_OFFSET + eventX * (overlaywidth - TIME_OFFSET), .5*overlayheight
- );
- stopuseMPgraphic
- starttext
- chapter[title={Inflation Theory},reference={inflation-theory}]
- section[title={13,799 ± 0.021},reference={section}]
- input ward
- chapter[title={First Stars},reference={first-stars}]
- section[title={13,689 ± 70},reference={section-1}]
- input ward
- stoptext
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement