Can LaTex Define Typographic Functions Similar to Postscript?

  • Context: LaTeX 
  • Thread starter Thread starter Stephen Tashi
  • Start date Start date
  • Tags Tags
    Functions Latex
Click For Summary
SUMMARY

LaTeX can define typographic functions similarly to Postscript through the use of macros. Users can create custom commands, such as \newcommand, to represent complex structures like matrices. For example, a user can define a matrix macro that takes a single letter input and generates a 3x3 matrix with that letter as a prefix for the elements. This capability allows for extensive customization and flexibility in typesetting mathematical expressions.

PREREQUISITES
  • Familiarity with LaTeX syntax and commands
  • Understanding of mathematical typesetting in LaTeX
  • Knowledge of macro definitions in LaTeX
  • Basic concepts of matrix representation
NEXT STEPS
  • Explore the \newcommand macro in LaTeX for custom command creation
  • Learn about advanced LaTeX packages for mathematical typesetting
  • Investigate the Turing-completeness of TeX and its implications
  • Study examples of complex LaTeX documents that utilize custom macros
USEFUL FOR

Mathematicians, LaTeX users, educators, and anyone interested in advanced typesetting techniques for mathematical documents.

Stephen Tashi
Science Advisor
Homework Helper
Education Advisor
Messages
7,864
Reaction score
1,605
Does LaTex have the ability to define typographic functions, in a manner similar to the way Postscript can? I've only studied LaTex by following examples and I haven't seen any with that degree of sophistication.

I'm not talking about whether one can write things like \sin{x}. As an example of what I mean, can you could write a function (or "macro") to represent a 3x3 matrix in terms of a letter that you would input. So matrix-macro(a) would give

\begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{bmatrix}

and matrix_macro(b) would give

\begin{bmatrix} b_{11} & b_{12} & b_{13}\\ b_{21} & b_{22} & b_{23} \\ b_{31} & b_{32} & b_{33} \end{bmatrix}
 
Physics news on Phys.org
Yes it does. Look up the \newcommand macro. Most "serious" tutorials on how to typeset math in LaTeX will have lots of examples.

You can't use "underscore" in your function names, but you could write something like
Code:
\newcommand{\mymatrix}[1]%
{\begin{bmatrix} #1_{11} & #1_{12} & #1_{13} \\ #1_{21} & #1_{22} & #1_{23} \\
#1_{31} & #1_{32} & #1_{33} \end{bmatrix}}

\begin{document}

$$\mymatrix{a}$$
$$\mymatrix{b}$$

\end{document}

In fact most "commands" in LaTeX (e.g. \bmatrix) are defined in this way, and if you don't like exactly what they do, you can change them.
 
I'd also point out that TeX is Turing-complete.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
6
Views
2K