Input an Sweave/knitr chunk via command sequence
This is a solution instead of a question. Over a long I have been wondering how to input an Sweave chunk template in LyX, i.e. = and @. I just figured it out thanks to the hint from Liviu. We can add a shortcut (Preferences=Editing=Shortcuts) with this command sequence (be sure _not_ to include the possible line breaks introduced by Gmail): command-sequence ert-insert; unicode-insert 0x3C; unicode-insert 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; break-paragraph; break-paragraph; unicode-insert 0x40; up; We can assign it to, say, Ctrl+Alt+I (the same shortcut as RStudio). Then we will be able to input this quickly: = # cursor moved here automatically @ Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA
Re: Input an Sweave/knitr chunk via command sequence
On Tue, Nov 27, 2012 at 12:44 PM, Yihui Xie x...@yihui.name wrote: This is a solution instead of a question. Over a long I have been wondering how to input an Sweave chunk template in LyX, i.e. = and @. I just figured it out thanks to the hint from Liviu. We can add a shortcut (Preferences=Editing=Shortcuts) with this command sequence (be sure _not_ to include the possible line breaks introduced by Gmail): command-sequence ert-insert; unicode-insert 0x3C; unicode-insert 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; break-paragraph; break-paragraph; unicode-insert 0x40; up; Thanks, Liviu and Yihui. This is indeed handy. Note that in master (to become 2.1), break-paragraph is renamed to paragraph-break. In master branch, the following works: command-sequence ert-insert; unicode-insert 0x3C; unicode-insert 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; paragraph-break; paragraph-break; unicode-insert 0x40; up; The former LFUN was discordant with the LFUN naming rules, in particular 1) Use the object.event order. That is, use `word-forward' instead of `forward-word' Scott
Re: Input an Sweave/knitr chunk via command sequence
Thanks, I'll keep that in mind. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Tue, Nov 27, 2012 at 12:21 PM, Scott Kostyshak skost...@lyx.org wrote: On Tue, Nov 27, 2012 at 12:44 PM, Yihui Xie x...@yihui.name wrote: This is a solution instead of a question. Over a long I have been wondering how to input an Sweave chunk template in LyX, i.e. = and @. I just figured it out thanks to the hint from Liviu. We can add a shortcut (Preferences=Editing=Shortcuts) with this command sequence (be sure _not_ to include the possible line breaks introduced by Gmail): command-sequence ert-insert; unicode-insert 0x3C; unicode-insert 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; break-paragraph; break-paragraph; unicode-insert 0x40; up; Thanks, Liviu and Yihui. This is indeed handy. Note that in master (to become 2.1), break-paragraph is renamed to paragraph-break. In master branch, the following works: command-sequence ert-insert; unicode-insert 0x3C; unicode-insert 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; paragraph-break; paragraph-break; unicode-insert 0x40; up; The former LFUN was discordant with the LFUN naming rules, in particular 1) Use the object.event order. That is, use `word-forward' instead of `forward-word' Scott
Input an Sweave/knitr chunk via command sequence
This is a solution instead of a question. Over a long I have been wondering how to input an Sweave chunk template in LyX, i.e. = and @. I just figured it out thanks to the hint from Liviu. We can add a shortcut (Preferences=Editing=Shortcuts) with this command sequence (be sure _not_ to include the possible line breaks introduced by Gmail): command-sequence ert-insert; unicode-insert 0x3C; unicode-insert 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; break-paragraph; break-paragraph; unicode-insert 0x40; up; We can assign it to, say, Ctrl+Alt+I (the same shortcut as RStudio). Then we will be able to input this quickly: = # cursor moved here automatically @ Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA
Re: Input an Sweave/knitr chunk via command sequence
On Tue, Nov 27, 2012 at 12:44 PM, Yihui Xie x...@yihui.name wrote: This is a solution instead of a question. Over a long I have been wondering how to input an Sweave chunk template in LyX, i.e. = and @. I just figured it out thanks to the hint from Liviu. We can add a shortcut (Preferences=Editing=Shortcuts) with this command sequence (be sure _not_ to include the possible line breaks introduced by Gmail): command-sequence ert-insert; unicode-insert 0x3C; unicode-insert 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; break-paragraph; break-paragraph; unicode-insert 0x40; up; Thanks, Liviu and Yihui. This is indeed handy. Note that in master (to become 2.1), break-paragraph is renamed to paragraph-break. In master branch, the following works: command-sequence ert-insert; unicode-insert 0x3C; unicode-insert 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; paragraph-break; paragraph-break; unicode-insert 0x40; up; The former LFUN was discordant with the LFUN naming rules, in particular 1) Use the object.event order. That is, use `word-forward' instead of `forward-word' Scott
Re: Input an Sweave/knitr chunk via command sequence
Thanks, I'll keep that in mind. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Tue, Nov 27, 2012 at 12:21 PM, Scott Kostyshak skost...@lyx.org wrote: On Tue, Nov 27, 2012 at 12:44 PM, Yihui Xie x...@yihui.name wrote: This is a solution instead of a question. Over a long I have been wondering how to input an Sweave chunk template in LyX, i.e. = and @. I just figured it out thanks to the hint from Liviu. We can add a shortcut (Preferences=Editing=Shortcuts) with this command sequence (be sure _not_ to include the possible line breaks introduced by Gmail): command-sequence ert-insert; unicode-insert 0x3C; unicode-insert 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; break-paragraph; break-paragraph; unicode-insert 0x40; up; Thanks, Liviu and Yihui. This is indeed handy. Note that in master (to become 2.1), break-paragraph is renamed to paragraph-break. In master branch, the following works: command-sequence ert-insert; unicode-insert 0x3C; unicode-insert 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; paragraph-break; paragraph-break; unicode-insert 0x40; up; The former LFUN was discordant with the LFUN naming rules, in particular 1) Use the object.event order. That is, use `word-forward' instead of `forward-word' Scott
Input an Sweave/knitr chunk via command sequence
This is a solution instead of a question. Over a long I have been wondering how to input an Sweave chunk template in LyX, i.e. <<>>= and @. I just figured it out thanks to the hint from Liviu. We can add a shortcut (Preferences=>Editing=>Shortcuts) with this command sequence (be sure _not_ to include the possible line breaks introduced by Gmail): command-sequence ert-insert; unicode-insert 0x3C; unicode-insert 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; break-paragraph; break-paragraph; unicode-insert 0x40; up; We can assign it to, say, Ctrl+Alt+I (the same shortcut as RStudio). Then we will be able to input this quickly: <<>>= # cursor moved here automatically @ Regards, Yihui -- Yihui XiePhone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA
Re: Input an Sweave/knitr chunk via command sequence
On Tue, Nov 27, 2012 at 12:44 PM, Yihui Xiewrote: > This is a solution instead of a question. Over a long I have been > wondering how to input an Sweave chunk template in LyX, i.e. <<>>= and > @. I just figured it out thanks to the hint from Liviu. We can add a > shortcut (Preferences=>Editing=>Shortcuts) with this command sequence > (be sure _not_ to include the possible line breaks introduced by > Gmail): > > command-sequence ert-insert; unicode-insert 0x3C; unicode-insert > 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; > break-paragraph; break-paragraph; unicode-insert 0x40; up; Thanks, Liviu and Yihui. This is indeed handy. Note that in master (to become 2.1), "break-paragraph" is renamed to "paragraph-break". In master branch, the following works: command-sequence ert-insert; unicode-insert 0x3C; unicode-insert 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; paragraph-break; paragraph-break; unicode-insert 0x40; up; The former LFUN was discordant with the LFUN naming rules, in particular <<1) Use the object.event order. That is, use `word-forward' instead of `forward-word'>> Scott
Re: Input an Sweave/knitr chunk via command sequence
Thanks, I'll keep that in mind. Regards, Yihui -- Yihui XiePhone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Tue, Nov 27, 2012 at 12:21 PM, Scott Kostyshak wrote: > On Tue, Nov 27, 2012 at 12:44 PM, Yihui Xie wrote: >> This is a solution instead of a question. Over a long I have been >> wondering how to input an Sweave chunk template in LyX, i.e. <<>>= and >> @. I just figured it out thanks to the hint from Liviu. We can add a >> shortcut (Preferences=>Editing=>Shortcuts) with this command sequence >> (be sure _not_ to include the possible line breaks introduced by >> Gmail): >> >> command-sequence ert-insert; unicode-insert 0x3C; unicode-insert >> 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; >> break-paragraph; break-paragraph; unicode-insert 0x40; up; > > Thanks, Liviu and Yihui. This is indeed handy. Note that in master (to > become 2.1), "break-paragraph" is renamed to "paragraph-break". > > In master branch, the following works: > > command-sequence ert-insert; unicode-insert 0x3C; unicode-insert > 0x3C; unicode-insert 0x3E; unicode-insert 0x3E; unicode-insert 0x3D; > paragraph-break; paragraph-break; unicode-insert 0x40; up; > > The former LFUN was discordant with the LFUN naming rules, in > particular <<1) Use the object.event order. That is, use > `word-forward' instead of `forward-word'>> > > Scott