📄 mf_display.hlp
字号:
{smcl}
{* 31mar2005}{...}
{cmd:help mata display()}
{hline}
{* index display()}{...}
{* index SMCL}{...}
{title:Title}
{p 4 4 2}
{bf:[M-5] display() -- Display text interpreting SMCL}
{title:Syntax}
{p 8 12 2}
{it:void}
{cmd:display(}{it:string colvector s}{cmd:)}
{p 8 12 2}
{it:void}
{cmd:display(}{it:string colvector s}{cmd:,}
{it:real scalar asis}{cmd:)}
{title:Description}
{p 4 4 2}
{cmd:display(}{it:s}{cmd:)}
displays the string or strings contained in {it:s}.
{p 4 4 2}
{cmd:display(}{it:s}{cmd:,} {it:asis}{cmd:)}
does the same thing, but allows you to control how SMCL codes are treated.
{cmd:display(}{it:s}{cmd:,} {cmd:0)} is equivalent to
{cmd:display(}{it:s}{cmd:)}; any SMCL codes are honored.
{p 4 4 2}
{cmd:display(}{it:s}{cmd:,} {it:asis}{cmd:)}, {it:asis}!=0, displays the
contents of {it:s} exactly as they are. For instance, when {it:asis}!=0,
"{c -(}it{c )-}" is just the string of characters {c -(}, i, t, and {c )-} and
those characters are displayed; "{c -(}it{c )-}" is not given the SMCL
interpretation enter italic mode.
{title:Remarks}
{p 4 4 2}
When {it:s} is a scalar, the differences between coding
: {cmd:display(}{it:s}{cmd:)}
{p 4 4 2}
and coding
: {it:s}
{p 4 4 2}
are
{p 8 12 2}
1. {cmd:display(}{it:s}{cmd:)} will not indent {it:s};
{it:s} by itself causes {it:s} to be indented by two spaces.
{p 8 12 2}
2. {cmd:display(}{it:s}{cmd:)} will honor any SMCL codes contained
in {it:s}; {cmd:s} by itself is equivalent to
{cmd:display(}{it:s}{cmd:,} {cmd:1)}. For example,
: {cmd:s = "this is an {c -(}it:example{c )-}"}
: {cmd:display(s)}
this is an {it:example}
: {cmd:s}
this is an {c -(}it:example{c )-}
{p 8 12 2}
3. When {it:s} is a vector, {cmd:display(}{it:s}{cmd:)}
simply displays the lines, whereas {it:s} by itself adorns the lines
with row and column numbers:
: {cmd:s = ("this is line 1" \ "this is line 2")}
: {cmd:display(s)}
this is line 1
this is line 2
: {cmd:s}
{res} {txt} 1
{c TLC}{hline 18}{c TRC}
1 {c |} {res}this is line 1{txt} {c |}
2 {c |} {res}this is line 2{txt} {c |}
{c BLC}{hline 18}{c BRC}{txt}
{p 4 4 2}
Another alternative to {cmd:display()} is {cmd:printf()}; see
{bf:{help mf_printf:[M-5] printf()}}.
When {it:s} is a scalar, {cmd:display()} and {cmd:printf()} do the same
thing:
: {cmd:display("this is an {c -(}it:example{c )-}")}
this is an {it:example}
: {cmd:printf("%s\n", "this is an {c -(}it:example{c )-}")}
this is an {it:example}
{p 4 4 2}
{cmd:printf()}, however, will not allow {it:s} to be nonscalar; it
has other capabilities.
{title:Conformability}
{cmd:display(}{it:s}{cmd:,} {it:asis}{cmd:)}
{it:s}: {it:k x} 1
{it:asis}: 1 {it:x} 1
{it:result}: {it:void}
{title:Source code}
{p 4 4 2}
Function is built-in.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] display()}
{p 4 13 2}
Online: help for
{bf:{help mf_displayas:[M-5] displayas()}},
{bf:{help mf_displayflush:[M-5] displayflush()}},
{bf:{help mf_printf:[M-5] printf()}};
{bf:{help m4_io:[M-4] io}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -