\typein (LaTeX2e unofficial reference manual (November 2018))

Next: \typeout, Previous: \read, Up: Input/output [Contents][Index]

### 27.3 `\typein`

Synopsis, one of:

    \typein{prompt-msg}
    \typein[cmd]{prompt-msg}

Print prompt-msg on the terminal and cause LaTeX to stop and wait for you to type a line of input. This line of input ends when you hit the return key.

For example, this

    As long as I live I shall never forget \typein{Enter student name:}

coupled with this command line interaction

    Enter student name:

    \@typein=Aphra Behn

gives the output ‘`... never forget Aphra Behn`’.

The first command version, `\typein{prompt-msg}`, causes the input you typed to be processed as if it had been included in the input file in place of the `\typein` command.

In the second command version the optional argument `cmd` argument must be a command name — it must begin with a backslash, \. This command name is then defined or redefined to be the input that you typed. For example, this

    \typein[\student]{Enter student name:}
    \typeout{Recommendation for \student .}

gives this output on the command line,

    Enter student name:

    \student=John Dee
    Recommendation for John Dee.

where the user has entered ‘`John Dee.`’

Unofficial LaTeX2e reference manual