Re: [NTG-context] Vim wiki page updated
On Wed, 2 Nov 2016, Nicola wrote: The syntax scripts in Vim already cover all of MetaFun. MetaFun keywords are highlighted by default inside ConTeXt documents; for MetaPost files ('mp' filetype), you must put let g:mp_metafun_macros = 1 into your vimrc. Ah, great! > The indent file is adapted from (I think) latex-suite's indent file with > modificiations that suit my taste. I am not sure these should go into > the default vim indent file, but it may be worthwhile for you to take a > quick look. MetaPost indentation is tough. I have rewritten the indent script in Vim from scratch, and now it works reasonably well. I will try yours, but you might try the one currently in Vim, too. I did not change metapost indenting, but defined some rules for indenting of context files. I believe that your indent file does not attempt to indent context files (I may be mistaken because I am just reading the .vim files, not testing it as I don't have vim8 yet). > The ftplugin file mainly contains shortcuts like `a expand to α, etc; > again, > adapted from latex-suite (which in-turn borred the idea from auctex). These > depend on a ftplugin file provided by latex-suite. There were also a few > macros to reflow text, but your code is more robust and has more features. I will look into those, too. Do you know that Vim has built-in support for digraphs (:h digraphs)? For example, α can be obtained by typing a* in Insert mode. I know of digraphis but it can be tricky to remember all the mapping (for example for \subset, \circ, etc.). Auctex uses fairly intuitive shortcuts. I could maybe create a GitHub repository, to make it easier to merge your work. That will be nice. Then I can also send you pull requests for specific things. Aditya___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Clickable question/answer numbers
Dear Otared, thank you again. This is somehow a proof that it should work. In my real document I use the title to name some exercises (after old exams), and I don't see how that can be combined with your solution. If someone else reads this: I think the question boils down to the following: \startquestion[Q:test] How can I here automatically get access to to the string "Q:test"? \stopquestion Best regards, Mikael On Wed, Nov 2, 2016 at 9:04 PM, Otared Kavian wrote: > Hi Mikael, > > A partial solution to the feature we are discussing is contained in the > example below, but somone more aware of ConTeXtish coding might improve it. > It is not satisfactory in that one has to define twice \startquestion and > \StartQuestion, \beginanswer and \BeginAnswer, and more importantly one > cannot generate automatically the references (I tried \getnumber[question] > and such to append to Q:\getnumber[question] for instance, but something does > not work…). > > Le me know if you find a satisfactory solution… > > Best regards: OK > %%% begin interactive-question-answer.tex > \setupinteraction[state=start,color=,contrastcolor=,style=] > > \defineblock[answer] > \hideblocks[answer] > > \def\myanswer[#1]{\inleft{\in[#1]\reference[A:#1]{\in[#1]}}} > > \define[1]\AnswerToQuestion{Question \goto{(see Solution)}[A:Q:#1]} > > \define[1]\StartQuestion{\startquestion[reference=Q:#1,title={\AnswerToQuestion{#1}}]} > > \define[1]\BeginAnswer{\beginanswer\myanswer[Q:#1]} > > \defineenumeration[question][ > text=, %Question, > headcolor=darkred, > title=yes, > titleleft=, > titleright={.}, > width=fit, > number=yes, > prefix=yes, > prefixsegments=section, > ] > > \starttext > > \section{A section with questions} > > \StartQuestion{test} > > Prove that $(a +b)^2 = a^2 + 2ab + b^2$ for all $a,b\in{\Bbb R}$. > > \BeginAnswer{test} > > Indeed $(a+b)^2 = (a+b)(a+b) = a^2 + ab + ba +b^2 = a^2 + 2ab +b^2$ since > $ba=ba$. > \endanswer > > \stopquestion > > \page[yes] > > \startsection[title={Answers to all questions}] > > \useblocks[answer] > > \stopsection > \stoptext > %%% end interactive-question-answer.tex > >> On 2 Nov 2016, at 16:16, Mikael P. Sundqvist wrote: >> >> Dear Otared (and list), >> >> thank you for your reply and support. >> >> The links from the answers to the questions work as wanted with my >> solution, it is the links from the questions to the answers that do >> not. >> >> I guess I need something like >> >> headcommand={\in{Question}[A:###]}, >> >> where ### is the reference tag I set. But I don't know what to change >> the ### into (or if that would work). >> >> Best regards, Mikael >> >> On Wed, Nov 2, 2016 at 1:52 PM, Otared Kavian wrote: >>> Hi Mikael, >>> >>> I had a similar question some time ago, but I wanted to add a sort of >>> automatic referencing of questions and answers (and interaction going from >>> questions to answers and back). >>> >>> If you accept the hurdle of adding manual references, in your case you can >>> add (for instance…) >>> >>>\goto{:-)}[Q:test] >>> >>> to the end of your answer to go back to the respective question. But when >>> you have several dozens of such references to add manually, it is not a >>> good idea. >>> >>> However I could not find a way to code the items (that is the questions) in >>> such a way that each adds automatically a unique reference, and so I am >>> interested too in the solution of the problem you mention. >>> >>> Best regards: OK >>> >>> On 2 Nov 2016, at 12:43, Mikael P. Sundqvist wrote: Dear list, I have a pretty large text with a lot of questions and answers, and want the user(students) to be able to click in the pdf to go from a certain exercise to its answer, and back. I have a solution (see below) to go from answers to questions, but not the other way around. I simply have no idea on how to make the red text (in the head) in the example question clickable with the answer on the next page as target. As you can see, the answer has a tag A:Q:test (I want to set these automatically in that manner), and clicking the green text I get to the correct place. I just don't see how to make the "Question 1.1" clickable with that target. I hope I make myself clear. If it matters, in the solution one could assume that the optional tag of the \startquestion \stopquestion is given for all questions. Best regards, Mikael %% qa.tex \setupinteraction[state=start,color=,contrastcolor=,style=] \defineblock[answer] \hideblocks[answer] \def\myanswer[#1]{\inleft{\in[#1]\reference[A:#1]{\in[#1]}}} \defineenumeration[question][ text=Question, headcolor=darkred, width=fit, number=yes, prefix=yes, prefixsegments=section, ] \starttext \section{A section with questions} >
Re: [NTG-context] Clickable question/answer numbers
Hi Mikael, A partial solution to the feature we are discussing is contained in the example below, but somone more aware of ConTeXtish coding might improve it. It is not satisfactory in that one has to define twice \startquestion and \StartQuestion, \beginanswer and \BeginAnswer, and more importantly one cannot generate automatically the references (I tried \getnumber[question] and such to append to Q:\getnumber[question] for instance, but something does not work…). Le me know if you find a satisfactory solution… Best regards: OK %%% begin interactive-question-answer.tex \setupinteraction[state=start,color=,contrastcolor=,style=] \defineblock[answer] \hideblocks[answer] \def\myanswer[#1]{\inleft{\in[#1]\reference[A:#1]{\in[#1]}}} \define[1]\AnswerToQuestion{Question \goto{(see Solution)}[A:Q:#1]} \define[1]\StartQuestion{\startquestion[reference=Q:#1,title={\AnswerToQuestion{#1}}]} \define[1]\BeginAnswer{\beginanswer\myanswer[Q:#1]} \defineenumeration[question][ text=, %Question, headcolor=darkred, title=yes, titleleft=, titleright={.}, width=fit, number=yes, prefix=yes, prefixsegments=section, ] \starttext \section{A section with questions} \StartQuestion{test} Prove that $(a +b)^2 = a^2 + 2ab + b^2$ for all $a,b\in{\Bbb R}$. \BeginAnswer{test} Indeed $(a+b)^2 = (a+b)(a+b) = a^2 + ab + ba +b^2 = a^2 + 2ab +b^2$ since $ba=ba$. \endanswer \stopquestion \page[yes] \startsection[title={Answers to all questions}] \useblocks[answer] \stopsection \stoptext %%% end interactive-question-answer.tex > On 2 Nov 2016, at 16:16, Mikael P. Sundqvist wrote: > > Dear Otared (and list), > > thank you for your reply and support. > > The links from the answers to the questions work as wanted with my > solution, it is the links from the questions to the answers that do > not. > > I guess I need something like > > headcommand={\in{Question}[A:###]}, > > where ### is the reference tag I set. But I don't know what to change > the ### into (or if that would work). > > Best regards, Mikael > > On Wed, Nov 2, 2016 at 1:52 PM, Otared Kavian wrote: >> Hi Mikael, >> >> I had a similar question some time ago, but I wanted to add a sort of >> automatic referencing of questions and answers (and interaction going from >> questions to answers and back). >> >> If you accept the hurdle of adding manual references, in your case you can >> add (for instance…) >> >>\goto{:-)}[Q:test] >> >> to the end of your answer to go back to the respective question. But when >> you have several dozens of such references to add manually, it is not a good >> idea. >> >> However I could not find a way to code the items (that is the questions) in >> such a way that each adds automatically a unique reference, and so I am >> interested too in the solution of the problem you mention. >> >> Best regards: OK >> >> >>> On 2 Nov 2016, at 12:43, Mikael P. Sundqvist wrote: >>> >>> Dear list, >>> >>> I have a pretty large text with a lot of questions and answers, and >>> want the user(students) to be able to click in the pdf to go from a >>> certain exercise to its answer, and back. I have a solution (see >>> below) to go from answers to questions, but not the other way around. >>> I simply have no idea on how to make the red text (in the head) in the >>> example question clickable with the answer on the next page as target. >>> As you can see, the answer has a tag A:Q:test (I want to set these >>> automatically in that manner), and clicking the green text I get to >>> the correct place. I just don't see how to make the "Question 1.1" >>> clickable with that target. >>> >>> I hope I make myself clear. If it matters, in the solution one could >>> assume that the optional tag of the \startquestion \stopquestion is >>> given for all questions. >>> >>> Best regards, Mikael >>> >>> %% qa.tex >>> \setupinteraction[state=start,color=,contrastcolor=,style=] >>> >>> \defineblock[answer] >>> \hideblocks[answer] >>> >>> \def\myanswer[#1]{\inleft{\in[#1]\reference[A:#1]{\in[#1]}}} >>> >>> \defineenumeration[question][ >>> text=Question, >>> headcolor=darkred, >>> width=fit, >>> number=yes, >>> prefix=yes, >>> prefixsegments=section, >>> ] >>> >>> \starttext >>> >>> \section{A section with questions} >>> >>> \startquestion[Q:test] >>> Solve this question! >>> \stopquestion >>> >>> We could, however, click \color[darkyellow]{\in{Answer}[A:Q:test]}. >>> >>> \beginanswer >>> \myanswer[Q:test] >>> What question? The answer is \quotation{do it yourself}! >>> \endanswer >>> >>> \page[yes] >>> >>> \subject{Answers} >>> >>> \useblocks[answer] >>> >>> \stoptext >>> ___ >>> If your question is of interest to others as well, please add an entry to >>> the Wiki! >>> >>> maillist : ntg-context@ntg.nl / >>> http://www.ntg.nl/mailman/listinfo/ntg-context >>> webpa
Re: [NTG-context] Vim wiki page updated
On 02/11/2016 19:39, Aditya Mahajan wrote: > On Tue, 1 Nov 2016, Nicola wrote: > >> I have updated the Vim page at ConTeXt Garden: >> >> http://wiki.contextgarden.net/Vim >> >> It may be considered as the official documentation of the ConTeXt >> scripts in Vim, as the only other documentation is the source code > > Hi Nicola, > > I wonder if you have seen my vim runtime files: > https://github.com/adityam/vim-context Unfortunately not, I worked only on those already in Vim. > The main file to look at is the syntax highlighting file. I haven't > compared > carefully with your version (haven't installed vim 8 yet), but there are a > few differences. It may be worthwhile to merge the two syntax files. Ok, I will take a look. I see that your file does not depend on plaintex.vim. It might be a good idea to remove that dependency... > The metapost syntax highlighting file defines a few keywords that are > used by > metafun. Could these be merged to your mp syntax highlighting file? The syntax scripts in Vim already cover all of MetaFun. MetaFun keywords are highlighted by default inside ConTeXt documents; for MetaPost files ('mp' filetype), you must put let g:mp_metafun_macros = 1 into your vimrc. > The indent file is adapted from (I think) latex-suite's indent file with > modificiations that suit my taste. I am not sure these should go into > the default vim indent file, but it may be worthwhile for you to take a > quick look. MetaPost indentation is tough. I have rewritten the indent script in Vim from scratch, and now it works reasonably well. I will try yours, but you might try the one currently in Vim, too. > The ftplugin file mainly contains shortcuts like `a expand to α, etc; > again, > adapted from latex-suite (which in-turn borred the idea from auctex). These > depend on a ftplugin file provided by latex-suite. There were also a few > macros to reflow text, but your code is more robust and has more features. I will look into those, too. Do you know that Vim has built-in support for digraphs (:h digraphs)? For example, α can be obtained by typing a* in Insert mode. > The compiler file is old and I haven't tested it in a few years, so please > ignore it. OK. I could maybe create a GitHub repository, to make it easier to merge your work. Nicola ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Vim wiki page updated
On Tue, 1 Nov 2016, Nicola wrote: I have updated the Vim page at ConTeXt Garden: http://wiki.contextgarden.net/Vim It may be considered as the official documentation of the ConTeXt scripts in Vim, as the only other documentation is the source code :) Hi Nicola, I wonder if you have seen my vim runtime files: https://github.com/adityam/vim-context The main file to look at is the syntax highlighting file. I haven't compared carefully with your version (haven't installed vim 8 yet), but there are a few differences. It may be worthwhile to merge the two syntax files. The metapost syntax highlighting file defines a few keywords that are used by metafun. Could these be merged to your mp syntax highlighting file? The indent file is adapted from (I think) latex-suite's indent file with modificiations that suit my taste. I am not sure these should go into the default vim indent file, but it may be worthwhile for you to take a quick look. The ftplugin file mainly contains shortcuts like `a expand to α, etc; again, adapted from latex-suite (which in-turn borred the idea from auctex). These depend on a ftplugin file provided by latex-suite. There were also a few macros to reflow text, but your code is more robust and has more features. The compiler file is old and I haven't tested it in a few years, so please ignore it. Thanks, Aditya___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] interline space for \setuplist[alternative=d]
Hans, I have the following sample: \setuppapersize[A6] \setupinteraction[state=start, focus=standard] \placebookmarks[chapter, section][chapter, section] \startsetups[lsect] \setupinterlinespace[line=28ex] \stopsetups \setuplist[section][style=\tfxx, alternative=d, setups=lsect] \starttext \completecontent \dorecurse{5}{\chapter{Knuth}\input knuth \dorecurse{8}{\section{Zapf}\input zapf}} \stoptext I cannot set the interline space for \setuplist[section]. Wolfgang kindly provided me with a workaround: \setuppapersize[A6] \setupinteraction[state=start, focus=standard] \placebookmarks[chapter, section][chapter, section] \startsetups[plsect] \start \setupinterlinespace [line=2.8ex] \placelist [section] [alternative=d, numbersegments=section, pagenumber=no, style=\itx] \par \stop \stopsetups \setuplist [chapter] [before={\blank[medium]}, after=\directsetup{plsect}] \starttext \placelist[chapter] \dorecurse{5}{\chapter{Knuth}\input knuth \dorecurse{8}{\section{Zapf}\input zapf}} \stoptext But the issue I discovered recently is that the first section links from the table of contents reach the chapter destination (and not the first section). Bookmarks work fine, instead. Wouldn’t it be better to improve the alternative=d in \setuplist, so that interline space could be set up with the setups option? Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] \definefallbackfamily for math fonts, again
Wolfgang Schuster írta: >\definefontfamily [doc] [rm] [TeX Gyre Bonum] >\definefontfamily [doc] [ss] [Tex Gyre Adventor] > >\definefallbackfamily [doc] [mm] [Tex Gyre Adventor] >[range=lowercasenormal,offset=lowercasesansserifnormal] >\definefallbackfamily [doc] [mm] [Tex Gyre Adventor] >[range=lowercasenormal,offset=lowercasesansserifnormal,tf=style:italic] > >\definefallbackfamily [doc] [mm] [Tex Gyre Adventor] >[range=uppercasenormal,offset=uppercasesansserifnormal] >\definefallbackfamily [doc] [mm] [Tex Gyre Adventor] >[range=uppercasenormal,offset=uppercasesansserifnormal,tf=style:italic] > >\definefontfamily [doc] [mm] [TeX Gyre Pagella Math] > >\setupbodyfont[doc,10pt] > >\starttext >Text font: , {\ss } >\par >Math font: \m{}, \m{\rm >}, \m{\ss } >\stoptext Thank you again, Wolfgang. Unfortunately I don't understand the syntax of \definefallbackfamily command and therefore I only copy/paste examples I found in the list and context wiki. I found the first mention of built-in simplefonts in this thread but it doesn't discuss \definefallbackfamily in detail: https://mailman.ntg.nl/pipermail/ntg-context/2013/075481.html I also looked at context wiki pages for Command/definefontfamily and Command/definefontfallback. All in all I am very confused how to use the command. It is not clear for me how to know if an option in \definefallbackfamily applies to the font to be replaced or to the replacement font. --For example I guess range= option applies to the font to be replaced: if the font/character lies within this range then it should be replaced by the font defined in \definfallbackfamily. Is this correct? --The preset= option is a predefined range; it is equal to some range= option. Is this correct? --What is offset=? Is this a range that should be used in the replacement? Does [range=lowercasenormal,offset=lowercasesansserifnormal] mean that lower case normal font should be replaced by lower case sans serif normal font? --Does the above imply that offset= option is only valid for math fonts and it can't be used for rm, ss and tt fonts? (E.g. \definefallbackfamily [doc] [rm] [TeX Gyre Bonum] explicitly defines a serif font, it would be nonsense to add offset=lowercasesansserifnormal option to the command.) --tf=style:italic: what does this exactly mean? If the replacement font drawing command is \tf then draw italic font? If yes, how it is different from offset=lowercasesansserifitalic? Is this command used in the same manner in \definefontfamily and \definefallbackfamily commands? Thank you in advance, bcsikos ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Clickable question/answer numbers
Dear Otared (and list), thank you for your reply and support. The links from the answers to the questions work as wanted with my solution, it is the links from the questions to the answers that do not. I guess I need something like headcommand={\in{Question}[A:###]}, where ### is the reference tag I set. But I don't know what to change the ### into (or if that would work). Best regards, Mikael On Wed, Nov 2, 2016 at 1:52 PM, Otared Kavian wrote: > Hi Mikael, > > I had a similar question some time ago, but I wanted to add a sort of > automatic referencing of questions and answers (and interaction going from > questions to answers and back). > > If you accept the hurdle of adding manual references, in your case you can > add (for instance…) > > \goto{:-)}[Q:test] > > to the end of your answer to go back to the respective question. But when you > have several dozens of such references to add manually, it is not a good idea. > > However I could not find a way to code the items (that is the questions) in > such a way that each adds automatically a unique reference, and so I am > interested too in the solution of the problem you mention. > > Best regards: OK > > >> On 2 Nov 2016, at 12:43, Mikael P. Sundqvist wrote: >> >> Dear list, >> >> I have a pretty large text with a lot of questions and answers, and >> want the user(students) to be able to click in the pdf to go from a >> certain exercise to its answer, and back. I have a solution (see >> below) to go from answers to questions, but not the other way around. >> I simply have no idea on how to make the red text (in the head) in the >> example question clickable with the answer on the next page as target. >> As you can see, the answer has a tag A:Q:test (I want to set these >> automatically in that manner), and clicking the green text I get to >> the correct place. I just don't see how to make the "Question 1.1" >> clickable with that target. >> >> I hope I make myself clear. If it matters, in the solution one could >> assume that the optional tag of the \startquestion \stopquestion is >> given for all questions. >> >> Best regards, Mikael >> >> %% qa.tex >> \setupinteraction[state=start,color=,contrastcolor=,style=] >> >> \defineblock[answer] >> \hideblocks[answer] >> >> \def\myanswer[#1]{\inleft{\in[#1]\reference[A:#1]{\in[#1]}}} >> >> \defineenumeration[question][ >> text=Question, >> headcolor=darkred, >> width=fit, >> number=yes, >> prefix=yes, >> prefixsegments=section, >> ] >> >> \starttext >> >> \section{A section with questions} >> >> \startquestion[Q:test] >> Solve this question! >> \stopquestion >> >> We could, however, click \color[darkyellow]{\in{Answer}[A:Q:test]}. >> >> \beginanswer >> \myanswer[Q:test] >> What question? The answer is \quotation{do it yourself}! >> \endanswer >> >> \page[yes] >> >> \subject{Answers} >> >> \useblocks[answer] >> >> \stoptext >> ___ >> If your question is of interest to others as well, please add an entry to >> the Wiki! >> >> maillist : ntg-context@ntg.nl / >> http://www.ntg.nl/mailman/listinfo/ntg-context >> webpage : http://www.pragma-ade.nl / http://context.aanhet.net >> archive : https://bitbucket.org/phg/context-mirror/commits/ >> wiki : http://contextgarden.net >> ___ > > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Clickable question/answer numbers
Hi Mikael, I had a similar question some time ago, but I wanted to add a sort of automatic referencing of questions and answers (and interaction going from questions to answers and back). If you accept the hurdle of adding manual references, in your case you can add (for instance…) \goto{:-)}[Q:test] to the end of your answer to go back to the respective question. But when you have several dozens of such references to add manually, it is not a good idea. However I could not find a way to code the items (that is the questions) in such a way that each adds automatically a unique reference, and so I am interested too in the solution of the problem you mention. Best regards: OK > On 2 Nov 2016, at 12:43, Mikael P. Sundqvist wrote: > > Dear list, > > I have a pretty large text with a lot of questions and answers, and > want the user(students) to be able to click in the pdf to go from a > certain exercise to its answer, and back. I have a solution (see > below) to go from answers to questions, but not the other way around. > I simply have no idea on how to make the red text (in the head) in the > example question clickable with the answer on the next page as target. > As you can see, the answer has a tag A:Q:test (I want to set these > automatically in that manner), and clicking the green text I get to > the correct place. I just don't see how to make the "Question 1.1" > clickable with that target. > > I hope I make myself clear. If it matters, in the solution one could > assume that the optional tag of the \startquestion \stopquestion is > given for all questions. > > Best regards, Mikael > > %% qa.tex > \setupinteraction[state=start,color=,contrastcolor=,style=] > > \defineblock[answer] > \hideblocks[answer] > > \def\myanswer[#1]{\inleft{\in[#1]\reference[A:#1]{\in[#1]}}} > > \defineenumeration[question][ > text=Question, > headcolor=darkred, > width=fit, > number=yes, > prefix=yes, > prefixsegments=section, > ] > > \starttext > > \section{A section with questions} > > \startquestion[Q:test] > Solve this question! > \stopquestion > > We could, however, click \color[darkyellow]{\in{Answer}[A:Q:test]}. > > \beginanswer > \myanswer[Q:test] > What question? The answer is \quotation{do it yourself}! > \endanswer > > \page[yes] > > \subject{Answers} > > \useblocks[answer] > > \stoptext > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Clickable question/answer numbers
Dear list, I have a pretty large text with a lot of questions and answers, and want the user(students) to be able to click in the pdf to go from a certain exercise to its answer, and back. I have a solution (see below) to go from answers to questions, but not the other way around. I simply have no idea on how to make the red text (in the head) in the example question clickable with the answer on the next page as target. As you can see, the answer has a tag A:Q:test (I want to set these automatically in that manner), and clicking the green text I get to the correct place. I just don't see how to make the "Question 1.1" clickable with that target. I hope I make myself clear. If it matters, in the solution one could assume that the optional tag of the \startquestion \stopquestion is given for all questions. Best regards, Mikael %% qa.tex \setupinteraction[state=start,color=,contrastcolor=,style=] \defineblock[answer] \hideblocks[answer] \def\myanswer[#1]{\inleft{\in[#1]\reference[A:#1]{\in[#1]}}} \defineenumeration[question][ text=Question, headcolor=darkred, width=fit, number=yes, prefix=yes, prefixsegments=section, ] \starttext \section{A section with questions} \startquestion[Q:test] Solve this question! \stopquestion We could, however, click \color[darkyellow]{\in{Answer}[A:Q:test]}. \beginanswer \myanswer[Q:test] What question? The answer is \quotation{do it yourself}! \endanswer \page[yes] \subject{Answers} \useblocks[answer] \stoptext qa.pdf Description: Adobe PDF document ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] grid, interlinespace
Hello I want my text on a grid and there should be no gap between the top and the capital letters of the first line. I managed to get this by changing the height parameter of \setupinterlinespace with a factor I calculated for the font with this formula: CapHeight/exheight / line = height CapHeight and exheight are font specific numbers that I got from https://tug.org/TUGboat/tb34-2/tb107sharpe.pdf for lmroman this gives me: 683 / 431 / 2.8 = .566 for height in interlinespace Although there is no gap to the top lines are jumping. making the factor bigger helps. but smaller fonts wont snap to the grid. What is happening here? And is this method of changing the height the right one? Thanks Michael -- \showgrid \setuplayout [grid=yes] \starttext \setupinterlinespace [ height=.566, line=2.8ex, ] \setupbodyfont [10pt] MM on grid but jumping\par \dorecurse{3}{\input tufte \par} \page \setupinterlinespace [ height=.575, line=2.8ex, ] \setupbodyfont [10pt] MM on grid\par \dorecurse{6}{\input tufte \par} \page \setupbodyfont [18pt] MM on grid\par \dorecurse{2}{\input tufte \par} \page \setupbodyfont [7pt] MM on grid\par \dorecurse{10}{\input tufte\par} \page \setupbodyfont [6pt] MM NOT on grid\par \dorecurse{10}{\input tufte \par} \page \setupinterlinespace [ height=.615, line=2.8ex, ] \setupbodyfont [6pt] MM on grid but gap to top\par \dorecurse{10}{\input tufte \par} \page \setupbodyfont [18pt] MM on grid but gap to top\par \dorecurse{2}{\input tufte \par} \page \stoptext - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Use \unit for value and uncertainty
On 10/31/2016 05:30 PM, Florian Leupold wrote: > Hello! > > There does not seem to be a simple solution to using \unit with > uncertainties, see below. > > Could someone maybe point me to the relevant source code for the parser for > \unit in MKIV? Then I would try to modify/improve the code myself. phys-dim.mkiv https://github.com/contextgarden/context-mirror/blob/beta/tex/context/base/mkiv/phys-dim.mkiv phys-dim.lua https://github.com/contextgarden/context-mirror/blob/beta/tex/context/base/mkiv/phys-dim.lua > > Thanks a lot and best regards, > Florian > > >> On 25.09.16, at 20:11, Florian Leupold wrote: >> >> Dear list >> >> Is it possible to use the units module (in MKIV) for value plusminus >> uncertainty in a way similar to the \SI command in LaTeX, like >> \unit{(1.59\pm2)e-19 coulomb} or >> \unit{1.59(2)e-19 coulomb}? >> >> Thanks and best regards, >> Florian >> ___ >> If your question is of interest to others as well, please add an entry to >> the Wiki! >> >> maillist : ntg-context@ntg.nl / >> http://www.ntg.nl/mailman/listinfo/ntg-context >> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net >> archive : http://foundry.supelec.fr/projects/contextrev/ >> wiki : http://contextgarden.net >> ___ > > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Vim wiki page updated
Excellent piece of work. Many thanks! > On 1 Nov 2016, at 14:13, Nicola wrote: > > I have updated the Vim page at ConTeXt Garden: > >http://wiki.contextgarden.net/Vim > > It may be considered as the official documentation of the ConTeXt scripts in > Vim, as the only other documentation is the source code :) > > Happy editing! > Nicola > > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___