ConTeXt: MetaPost graphic in overlay setups shifts between pagesHow to debug METAPOST inlined in ConTeXt? (Or “message” primitive and “loggingall;” in inlined METAPOST)Use fancy page numbering using Metapost graphicConTeXt+MetaPost: Non-conflicting random background and foreground coloursparametric overlay in contextHow include MetaPost from ConTeXt to LaTeX?Metapost error related with ConTeXtMetapost graphics not aligned in ConTeXt TABLEConTeXt and Metafun: Using environment variables inside overlayvertically center all slides in ConTeXt with minimal setupsConTeXt: What are alternatives and rendering setups?

A possible fake AI on Patreon!

Why the difference in metal between 銀行 and お金?

Pressure to defend the relevance of one's area of mathematics

What is the strongest case that can be made in favour of the UK regaining some control over fishing policy after Brexit?

"The cow" OR "a cow" OR "cows" in this context

A ​Note ​on ​N!

Realistic Necromancy?

Do I have to worry about players making “bad” choices on level up?

Why we can't write in air?

Rivers without rain

How to interact with ERC20 interface?

With a Canadian student visa, can I spend a night at Vancouver before continuing to Toronto?

Are Boeing 737-800’s grounded?

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?

French for 'It must be my imagination'?

How can the Zone of Truth spell be defeated without the caster knowing?

Any examples of headwear for races with animal ears?

Binary Numbers Magic Trick

Why does processed meat contain preservatives, while canned fish needs not?

How can I change the color of a part of a line?

Is it possible to dynamically set properties of an `Object` using Apex?

Why does nature favour the Laplacian?

Sci-fi book: portals appear in London and send a failed artist towards a designated path where he operate a giant superweapon

Stop and Take a Breath!



ConTeXt: MetaPost graphic in overlay setups shifts between pages


How to debug METAPOST inlined in ConTeXt? (Or “message” primitive and “loggingall;” in inlined METAPOST)Use fancy page numbering using Metapost graphicConTeXt+MetaPost: Non-conflicting random background and foreground coloursparametric overlay in contextHow include MetaPost from ConTeXt to LaTeX?Metapost error related with ConTeXtMetapost graphics not aligned in ConTeXt TABLEConTeXt and Metafun: Using environment variables inside overlayvertically center all slides in ConTeXt with minimal setupsConTeXt: What are alternatives and rendering setups?













3















Background



A line is being drawn using MetaPost on an overlay, which is used as the background for a framed layer. The layer is embedded within a setups so that a dot's position on the timeline is recalculated each time. The calculation is based on the value of the current section's title text.



Problem



The horizontal bars at the each end of the timeline shifts a slight amount. Compare:



Chapter 1



Chapter 2



When shown overlapped, the difference is apparent, albeit subtle:



Shifted Bars



Code



The minimal working example is reasonably straightforward. The bulk of the code is taken up by parsing the number from the section title within startuseMPgraphic.



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][useMPgraphicBookTimelineGraphic]

startuseMPgraphicBookTimelineGraphic
% Define constants
numeric EVENT_BEGAN, TIME_OFFSET, PATH_THICKNESS;
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 := "getspecificstructuretitle3";
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


Questions



I'm wondering:



  • Why does the timeline bar shift slightly?

  • How can the shifting be eliminated such that the timeline bars precisely overlap regardless of the timeline's dot's location?

Bonus question:



  • How can the code be simplified, especially parsing the title?









share|improve this question



















  • 1





    Why don't you draw the rule as part of setuphead? Why do you try use for line continuation? MetaPost scans until a semicolon and is actually a TeX control sequence which expands to a blank space.

    – Henri Menke
    4 hours ago















3















Background



A line is being drawn using MetaPost on an overlay, which is used as the background for a framed layer. The layer is embedded within a setups so that a dot's position on the timeline is recalculated each time. The calculation is based on the value of the current section's title text.



Problem



The horizontal bars at the each end of the timeline shifts a slight amount. Compare:



Chapter 1



Chapter 2



When shown overlapped, the difference is apparent, albeit subtle:



Shifted Bars



Code



The minimal working example is reasonably straightforward. The bulk of the code is taken up by parsing the number from the section title within startuseMPgraphic.



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][useMPgraphicBookTimelineGraphic]

startuseMPgraphicBookTimelineGraphic
% Define constants
numeric EVENT_BEGAN, TIME_OFFSET, PATH_THICKNESS;
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 := "getspecificstructuretitle3";
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


Questions



I'm wondering:



  • Why does the timeline bar shift slightly?

  • How can the shifting be eliminated such that the timeline bars precisely overlap regardless of the timeline's dot's location?

Bonus question:



  • How can the code be simplified, especially parsing the title?









share|improve this question



















  • 1





    Why don't you draw the rule as part of setuphead? Why do you try use for line continuation? MetaPost scans until a semicolon and is actually a TeX control sequence which expands to a blank space.

    – Henri Menke
    4 hours ago













3












3








3








Background



A line is being drawn using MetaPost on an overlay, which is used as the background for a framed layer. The layer is embedded within a setups so that a dot's position on the timeline is recalculated each time. The calculation is based on the value of the current section's title text.



Problem



The horizontal bars at the each end of the timeline shifts a slight amount. Compare:



Chapter 1



Chapter 2



When shown overlapped, the difference is apparent, albeit subtle:



Shifted Bars



Code



The minimal working example is reasonably straightforward. The bulk of the code is taken up by parsing the number from the section title within startuseMPgraphic.



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][useMPgraphicBookTimelineGraphic]

startuseMPgraphicBookTimelineGraphic
% Define constants
numeric EVENT_BEGAN, TIME_OFFSET, PATH_THICKNESS;
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 := "getspecificstructuretitle3";
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


Questions



I'm wondering:



  • Why does the timeline bar shift slightly?

  • How can the shifting be eliminated such that the timeline bars precisely overlap regardless of the timeline's dot's location?

Bonus question:



  • How can the code be simplified, especially parsing the title?









share|improve this question
















Background



A line is being drawn using MetaPost on an overlay, which is used as the background for a framed layer. The layer is embedded within a setups so that a dot's position on the timeline is recalculated each time. The calculation is based on the value of the current section's title text.



Problem



The horizontal bars at the each end of the timeline shifts a slight amount. Compare:



Chapter 1



Chapter 2



When shown overlapped, the difference is apparent, albeit subtle:



Shifted Bars



Code



The minimal working example is reasonably straightforward. The bulk of the code is taken up by parsing the number from the section title within startuseMPgraphic.



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][useMPgraphicBookTimelineGraphic]

startuseMPgraphicBookTimelineGraphic
% Define constants
numeric EVENT_BEGAN, TIME_OFFSET, PATH_THICKNESS;
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 := "getspecificstructuretitle3";
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


Questions



I'm wondering:



  • Why does the timeline bar shift slightly?

  • How can the shifting be eliminated such that the timeline bars precisely overlap regardless of the timeline's dot's location?

Bonus question:



  • How can the code be simplified, especially parsing the title?






context framed calculations metapost






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 5 hours ago







Dave Jarvis

















asked 5 hours ago









Dave JarvisDave Jarvis

4,77184084




4,77184084







  • 1





    Why don't you draw the rule as part of setuphead? Why do you try use for line continuation? MetaPost scans until a semicolon and is actually a TeX control sequence which expands to a blank space.

    – Henri Menke
    4 hours ago












  • 1





    Why don't you draw the rule as part of setuphead? Why do you try use for line continuation? MetaPost scans until a semicolon and is actually a TeX control sequence which expands to a blank space.

    – Henri Menke
    4 hours ago







1




1





Why don't you draw the rule as part of setuphead? Why do you try use for line continuation? MetaPost scans until a semicolon and is actually a TeX control sequence which expands to a blank space.

– Henri Menke
4 hours ago





Why don't you draw the rule as part of setuphead? Why do you try use for line continuation? MetaPost scans until a semicolon and is actually a TeX control sequence which expands to a blank space.

– Henri Menke
4 hours ago










1 Answer
1






active

oldest

votes


















3














The placement of the dot modifies the bounding box. The most ad-hoc solution to this problem is



  1. Save the bounding box before drawing the dot

  2. Draw the dot

  3. Restore the bounding box without dot

The dot will then leak out of the bounding box but that is only a tiny bit.



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][useMPgraphicBookTimelineGraphic]

startuseMPgraphicBookTimelineGraphic
% Define constants
numeric EVENT_BEGAN, TIME_OFFSET, PATH_THICKNESS;
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 := "getspecificstructuretitle3";
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;

% The dot will change the size of bounding box, so we will just save the
% bounding box without the dot for later
path p ; p := bbox currentpicture ;

% 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
);

% Restore the bounding box without dot
setbounds currentpicture to p ;
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


Here is a little shorter version of your code, using Lua to parse the chapter title and using the MetaPost drawing as a background for the text layer of the page directly.



definepapersize
[BookPaperSize]
[width=8in,
height=6in]

setuppapersize[BookPaperSize]

defineoverlay
[BookTimelineOverlay]
[useMPgraphicBookTimelineGraphic]

setupbackgrounds
[text]
[background=BookTimelineOverlay]


startluacode
function userdata.parsetitle(title)
local a, b = string.match(title, "(%d+),(%d+)")
return table.concat( a, b , "")
end
stopluacode

startuseMPgraphicBookTimelineGraphic
% Define constants
numeric EVENT_BEGAN;
EVENT_BEGAN := 13799;

% Convert the digits from a string to a numeric value.
numeric eventX;
eventX := lua("mp.print(userdata.parsetitle('getspecificstructuretitle3'))") ;
eventX := 1 - (eventX / EVENT_BEGAN);

numeric wb, hb ; wb := 3.33in ; hb := .33in ;
pickup pencircle scaled 2pt;
picture p ; p := image(
% Draw the line.
draw (0, .5*hb) -- (wb, .5*hb) ;
% Draw starting |.
draw (0, 0) -- (0, hb) ;
% Draw ending |.
draw (wb, 0) -- (wb, hb) ;
% Draw the timeline's dot relative to the event on the timeline.
filldraw fullcircle scaled 9 shifted (eventX * wb, .5*hb);
);

numeric h ; h := OverlayHeight ;
draw p shifted (-.33in, h - hb - .33in);

setbounds currentpicture to OverlayBox ;
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





share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "85"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f488034%2fcontext-metapost-graphic-in-overlay-setups-shifts-between-pages%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    The placement of the dot modifies the bounding box. The most ad-hoc solution to this problem is



    1. Save the bounding box before drawing the dot

    2. Draw the dot

    3. Restore the bounding box without dot

    The dot will then leak out of the bounding box but that is only a tiny bit.



    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][useMPgraphicBookTimelineGraphic]

    startuseMPgraphicBookTimelineGraphic
    % Define constants
    numeric EVENT_BEGAN, TIME_OFFSET, PATH_THICKNESS;
    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 := "getspecificstructuretitle3";
    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;

    % The dot will change the size of bounding box, so we will just save the
    % bounding box without the dot for later
    path p ; p := bbox currentpicture ;

    % 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
    );

    % Restore the bounding box without dot
    setbounds currentpicture to p ;
    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


    Here is a little shorter version of your code, using Lua to parse the chapter title and using the MetaPost drawing as a background for the text layer of the page directly.



    definepapersize
    [BookPaperSize]
    [width=8in,
    height=6in]

    setuppapersize[BookPaperSize]

    defineoverlay
    [BookTimelineOverlay]
    [useMPgraphicBookTimelineGraphic]

    setupbackgrounds
    [text]
    [background=BookTimelineOverlay]


    startluacode
    function userdata.parsetitle(title)
    local a, b = string.match(title, "(%d+),(%d+)")
    return table.concat( a, b , "")
    end
    stopluacode

    startuseMPgraphicBookTimelineGraphic
    % Define constants
    numeric EVENT_BEGAN;
    EVENT_BEGAN := 13799;

    % Convert the digits from a string to a numeric value.
    numeric eventX;
    eventX := lua("mp.print(userdata.parsetitle('getspecificstructuretitle3'))") ;
    eventX := 1 - (eventX / EVENT_BEGAN);

    numeric wb, hb ; wb := 3.33in ; hb := .33in ;
    pickup pencircle scaled 2pt;
    picture p ; p := image(
    % Draw the line.
    draw (0, .5*hb) -- (wb, .5*hb) ;
    % Draw starting |.
    draw (0, 0) -- (0, hb) ;
    % Draw ending |.
    draw (wb, 0) -- (wb, hb) ;
    % Draw the timeline's dot relative to the event on the timeline.
    filldraw fullcircle scaled 9 shifted (eventX * wb, .5*hb);
    );

    numeric h ; h := OverlayHeight ;
    draw p shifted (-.33in, h - hb - .33in);

    setbounds currentpicture to OverlayBox ;
    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





    share|improve this answer





























      3














      The placement of the dot modifies the bounding box. The most ad-hoc solution to this problem is



      1. Save the bounding box before drawing the dot

      2. Draw the dot

      3. Restore the bounding box without dot

      The dot will then leak out of the bounding box but that is only a tiny bit.



      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][useMPgraphicBookTimelineGraphic]

      startuseMPgraphicBookTimelineGraphic
      % Define constants
      numeric EVENT_BEGAN, TIME_OFFSET, PATH_THICKNESS;
      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 := "getspecificstructuretitle3";
      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;

      % The dot will change the size of bounding box, so we will just save the
      % bounding box without the dot for later
      path p ; p := bbox currentpicture ;

      % 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
      );

      % Restore the bounding box without dot
      setbounds currentpicture to p ;
      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


      Here is a little shorter version of your code, using Lua to parse the chapter title and using the MetaPost drawing as a background for the text layer of the page directly.



      definepapersize
      [BookPaperSize]
      [width=8in,
      height=6in]

      setuppapersize[BookPaperSize]

      defineoverlay
      [BookTimelineOverlay]
      [useMPgraphicBookTimelineGraphic]

      setupbackgrounds
      [text]
      [background=BookTimelineOverlay]


      startluacode
      function userdata.parsetitle(title)
      local a, b = string.match(title, "(%d+),(%d+)")
      return table.concat( a, b , "")
      end
      stopluacode

      startuseMPgraphicBookTimelineGraphic
      % Define constants
      numeric EVENT_BEGAN;
      EVENT_BEGAN := 13799;

      % Convert the digits from a string to a numeric value.
      numeric eventX;
      eventX := lua("mp.print(userdata.parsetitle('getspecificstructuretitle3'))") ;
      eventX := 1 - (eventX / EVENT_BEGAN);

      numeric wb, hb ; wb := 3.33in ; hb := .33in ;
      pickup pencircle scaled 2pt;
      picture p ; p := image(
      % Draw the line.
      draw (0, .5*hb) -- (wb, .5*hb) ;
      % Draw starting |.
      draw (0, 0) -- (0, hb) ;
      % Draw ending |.
      draw (wb, 0) -- (wb, hb) ;
      % Draw the timeline's dot relative to the event on the timeline.
      filldraw fullcircle scaled 9 shifted (eventX * wb, .5*hb);
      );

      numeric h ; h := OverlayHeight ;
      draw p shifted (-.33in, h - hb - .33in);

      setbounds currentpicture to OverlayBox ;
      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





      share|improve this answer



























        3












        3








        3







        The placement of the dot modifies the bounding box. The most ad-hoc solution to this problem is



        1. Save the bounding box before drawing the dot

        2. Draw the dot

        3. Restore the bounding box without dot

        The dot will then leak out of the bounding box but that is only a tiny bit.



        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][useMPgraphicBookTimelineGraphic]

        startuseMPgraphicBookTimelineGraphic
        % Define constants
        numeric EVENT_BEGAN, TIME_OFFSET, PATH_THICKNESS;
        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 := "getspecificstructuretitle3";
        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;

        % The dot will change the size of bounding box, so we will just save the
        % bounding box without the dot for later
        path p ; p := bbox currentpicture ;

        % 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
        );

        % Restore the bounding box without dot
        setbounds currentpicture to p ;
        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


        Here is a little shorter version of your code, using Lua to parse the chapter title and using the MetaPost drawing as a background for the text layer of the page directly.



        definepapersize
        [BookPaperSize]
        [width=8in,
        height=6in]

        setuppapersize[BookPaperSize]

        defineoverlay
        [BookTimelineOverlay]
        [useMPgraphicBookTimelineGraphic]

        setupbackgrounds
        [text]
        [background=BookTimelineOverlay]


        startluacode
        function userdata.parsetitle(title)
        local a, b = string.match(title, "(%d+),(%d+)")
        return table.concat( a, b , "")
        end
        stopluacode

        startuseMPgraphicBookTimelineGraphic
        % Define constants
        numeric EVENT_BEGAN;
        EVENT_BEGAN := 13799;

        % Convert the digits from a string to a numeric value.
        numeric eventX;
        eventX := lua("mp.print(userdata.parsetitle('getspecificstructuretitle3'))") ;
        eventX := 1 - (eventX / EVENT_BEGAN);

        numeric wb, hb ; wb := 3.33in ; hb := .33in ;
        pickup pencircle scaled 2pt;
        picture p ; p := image(
        % Draw the line.
        draw (0, .5*hb) -- (wb, .5*hb) ;
        % Draw starting |.
        draw (0, 0) -- (0, hb) ;
        % Draw ending |.
        draw (wb, 0) -- (wb, hb) ;
        % Draw the timeline's dot relative to the event on the timeline.
        filldraw fullcircle scaled 9 shifted (eventX * wb, .5*hb);
        );

        numeric h ; h := OverlayHeight ;
        draw p shifted (-.33in, h - hb - .33in);

        setbounds currentpicture to OverlayBox ;
        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





        share|improve this answer















        The placement of the dot modifies the bounding box. The most ad-hoc solution to this problem is



        1. Save the bounding box before drawing the dot

        2. Draw the dot

        3. Restore the bounding box without dot

        The dot will then leak out of the bounding box but that is only a tiny bit.



        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][useMPgraphicBookTimelineGraphic]

        startuseMPgraphicBookTimelineGraphic
        % Define constants
        numeric EVENT_BEGAN, TIME_OFFSET, PATH_THICKNESS;
        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 := "getspecificstructuretitle3";
        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;

        % The dot will change the size of bounding box, so we will just save the
        % bounding box without the dot for later
        path p ; p := bbox currentpicture ;

        % 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
        );

        % Restore the bounding box without dot
        setbounds currentpicture to p ;
        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


        Here is a little shorter version of your code, using Lua to parse the chapter title and using the MetaPost drawing as a background for the text layer of the page directly.



        definepapersize
        [BookPaperSize]
        [width=8in,
        height=6in]

        setuppapersize[BookPaperSize]

        defineoverlay
        [BookTimelineOverlay]
        [useMPgraphicBookTimelineGraphic]

        setupbackgrounds
        [text]
        [background=BookTimelineOverlay]


        startluacode
        function userdata.parsetitle(title)
        local a, b = string.match(title, "(%d+),(%d+)")
        return table.concat( a, b , "")
        end
        stopluacode

        startuseMPgraphicBookTimelineGraphic
        % Define constants
        numeric EVENT_BEGAN;
        EVENT_BEGAN := 13799;

        % Convert the digits from a string to a numeric value.
        numeric eventX;
        eventX := lua("mp.print(userdata.parsetitle('getspecificstructuretitle3'))") ;
        eventX := 1 - (eventX / EVENT_BEGAN);

        numeric wb, hb ; wb := 3.33in ; hb := .33in ;
        pickup pencircle scaled 2pt;
        picture p ; p := image(
        % Draw the line.
        draw (0, .5*hb) -- (wb, .5*hb) ;
        % Draw starting |.
        draw (0, 0) -- (0, hb) ;
        % Draw ending |.
        draw (wb, 0) -- (wb, hb) ;
        % Draw the timeline's dot relative to the event on the timeline.
        filldraw fullcircle scaled 9 shifted (eventX * wb, .5*hb);
        );

        numeric h ; h := OverlayHeight ;
        draw p shifted (-.33in, h - hb - .33in);

        setbounds currentpicture to OverlayBox ;
        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






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 3 hours ago

























        answered 4 hours ago









        Henri MenkeHenri Menke

        78.1k8171285




        78.1k8171285



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f488034%2fcontext-metapost-graphic-in-overlay-setups-shifts-between-pages%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

            Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

            How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2