How do I write this type of mathematical letter in LaTeX? I have tried \mathnormal but I can not make it bold.
To have the exact same type of bold and cursive x, then you can use $\boldsymbol{x}$. However, if all you want is a bold (but upright x), you can use \mathbf{ }.
By the way, if you are having to write a bunch of these, then I usually define a shorthand command:
\newcommand{\+}[1]{\ensuremath{\boldsymbol{#1}}}
which you can then write your example as:
$\+x_1, \+x_2, \ldots, \+x_n$
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\boldsymbol{x}_{1}, \boldsymbol{x}_{2}, \dots ,\boldsymbol{x}_{3}
\]
\end{document}
Related
I'm trying to make an environment that builds a column vector, and that takes as input the scale factor of the distancing between the rows:
\newenvironment{VEC}[1]{\begin{Bmatrix}\renewcommand{\arraystretch}{#1}}
{\end{Bmatrix}}
I know that the \newenvironment command accepts as input only strings, so I tried with \value{#1} having no successfull result. Any help would be appreciated.
Nothing to do with newenvironment or arguments, you just need to switch the order:
\documentclass{article}
\usepackage{mathtools}
\newenvironment{VEC}[1]{\renewcommand{\arraystretch}{#1}\begin{Bmatrix}}
{\end{Bmatrix}}
\begin{document}
\[
\begin{VEC}{3}
4\\
6\\
\end{VEC}
\]
\end{document}
How to use inverted A character(Phonetic Symbol) in an equation in LaTex? Do I have to use any specific package for it? I used \textinvsca, but it says "undefined control sequence"
There are a myriad of ways you can achieve this. Most notably, consult How to look up a symbol or identify a math symbol or character?.
This reveals you need tipa (more specifically, \usepackage{tipx}):
\documentclass{article}
\usepackage{tipx}
\begin{document}
A\textsc{a}\textinvsca\textsc{a}A
\end{document}
You can also rotate-and-scale a regular A:
\documentclass{article}
\usepackage{graphicx}
\newcommand{\textinvsca}{%
\reflectbox{%
\rotatebox[origin=c]{180}{%
\resizebox{!}{.35\baselineskip}{\textsc{A}}}}}
\begin{document}
A\textsc{a}\textinvsca\textsc{a}A
\end{document}
\forall is the universal quantifier:
I’m a big fan of ampersands – so much that I heed SimpleBits’ advice to “use the best available ampersand” quite religiously.
For that purpose, I’ve defined the following shortcut in LaTeX:
\let\amp\&
\renewcommand\&{{\scalebox{1.2}{\textnormal{\fontspec{Baskerville}\itshape\amp}}}}
In brief, this changes all uses of the “normal” ampersand to a stylish variant, e.g.:
This is a text \& it contains an ampersand.
(Using \& instead of just & since that’s how LaTeX works – the latter is already reserved to separate columns in table environments.)
However, this always uses the same font – here, Baskerville – no matter whether it fits or not. I’d like to use a different font depending on the font family used. That is, I want to use another ampersand in combination with sans serif text, and in particular I want to prevent rewriting of the ampersand in a monospace context. So in the following two contexts, I don’t want to trigger the above definition:
{\sffamily a \& b}
{\ttfamily a \& b}
How do I do that?
I imagine something like the following:
\renewcommand\&{
\ifsans
{\fontspec{Trebuchet MS}{\textnormal{\itshape\amp}}}
\else
\ifmono
\amp
\else
{\fontspec{Baskerville}\scalebox{1.2}{\textnormal{\itshape\amp}}}
\fi
\fi}
It works the following way:
\documentclass[letterpaper,10pt]{article}
\usepackage[latin1]{inputenc}
\usepackage{german}
\usepackage{geometry}
\geometry{margin=2cm}
\newcommand*\origsffamily{}
\let\origsffamily\sffamily
\renewcommand*\sffamily{\origsffamily\small {\renewcommand\&{{\scalebox{1.2}{\textnormal{\fontspec{Baskerville}\itshape\amp}}}}}}
\begin{document}
hello, this is \& a \sffamily test \&
\end{document}
That means, you include the change of the ampersand sign into the definition of (in my example) \sffamily.
The drawback is - of course - that you have to do this for all desired font families.
You can test for the standard LaTeX token list \f#family, however, this might not be as reliable as you want. The following code simply checks whether the current family equals the default families set by \setmainfont and \setsansfont, but not whether the fonts are really sans-serif:
\documentclass{article}
\usepackage{fontspec}
\usepackage{expl3}
\usepackage{xparse}
\setmainfont{DejaVu Serif}
\setsansfont{DejaVu Sans}
\makeatletter
\ExplSyntaxOn
\NewDocumentCommand \amp { } {
\tl_if_eq:NNTF \f#family \rmdefault {
% this is a roman font
A
} {
\tl_if_eq:NNTF \f#family \sfdefault {
% this is a sans font
B
} {
% something else
C
}
}
}
\ExplSyntaxOff
\makeatother
\begin{document}
test \amp\ test
\sffamily
test \amp\ test
\ttfamily
test \amp\ test
\end{document}
I have a figure in LaTeX with a caption to which I need to add a formula (equation* or displaymath environments). For example:
\documentclass[12pt]{article}
\begin{document}
\begin{figure}[tbph]
\begin{center}
%...
\end{center}
\caption{As you can see
\begin{displaymath}4 \ne 5\end{displaymath}
}
\label{fig:somefig}
\end{figure}
\end{document}
This makes pdflatex angry, though it will produce a PDF.
! Argument of \#caption has an extra }.
<inserted text>
\par
l.9 }
What's the right way to go about adding an equation to a figure caption?
NOTE: Please do not suggest simply using the $ ... $ math environment;
the equation shown is a toy example; my real equation is much more intricate.
See also:
Adding a caption to an equation in LaTeX (the reverse of this question)
Using the package "caption":
\begin{figure}
\begin{center}
...
\captionsetup{singlelinecheck=off}
\caption[.]{
\begin{displaymath}
assoc\_meaning(\lambda x_{SBJ}. followed(x,y) \&actor(x) \nonumber \&actor(y),\lambda x_{SBJ}. maintained(x,\nonumber <(dist\_from(y),1))
\end{displaymath}}
\end{center}
\end{figure}
The square brackets following \caption aren't optional, but leaving them off won't cause an error that looks any different than the one before you added \usepackage{caption} and \captionsetup{...}.
I'm not sure why you do not want to use the $ ... $ solution, because of fractions?
If so, you can use \dfrac instead of \frac.
I would try $ \displaystyle \dfrac{1}{2} \cdot \sum_{i=0}^n i$, i.e. use the \displaystyle command.
Well, it seems simple enough, but I can't find a way to add a caption to an equation.
The caption is needed to explain the variables used in the equation, so some kind of table-like structure to keep it all aligned and pretty would be great.
The \caption command is restricted to floats: you will need to place the equation in a figure or table environment (or a new kind of floating environment). For example:
\begin{figure}
\[ E = m c^2 \]
\caption{A famous equation}
\end{figure}
The point of floats is that you let LaTeX determine their placement. If you want to equation to appear in a fixed position, don't use a float. The \captionof command of the caption package can be used to place a caption outside of a floating environment. It is used like this:
\[ E = m c^2 \]
\captionof{figure}{A famous equation}
This will also produce an entry for the \listoffigures, if your document has one.
To align parts of an equation, take a look at the eqnarray environment, or some of the environments of the amsmath package: align, gather, multiline,...
You may want to look at http://tug.ctan.org/tex-archive/macros/latex/contrib/float/ which allows you to define new floats using \newfloat
I say this because captions are usually applied to floats.
Straight ahead equations (those written with $ ... $, $$ ... $$, begin{equation}...) are in-line objects that do not support \caption.
This can be done using the following snippet just before \begin{document}
\usepackage{float}
\usepackage{aliascnt}
\newaliascnt{eqfloat}{equation}
\newfloat{eqfloat}{h}{eqflts}
\floatname{eqfloat}{Equation}
\newcommand*{\ORGeqfloat}{}
\let\ORGeqfloat\eqfloat
\def\eqfloat{%
\let\ORIGINALcaption\caption
\def\caption{%
\addtocounter{equation}{-1}%
\ORIGINALcaption
}%
\ORGeqfloat
}
and when adding an equation use something like
\begin{eqfloat}
\begin{equation}
f( x ) = ax + b
\label{eq:linear}
\end{equation}
\caption{Caption goes here}
\end{eqfloat}
As in this forum post by Gonzalo Medina, a third way may be:
\documentclass{article}
\usepackage{caption}
\DeclareCaptionType{equ}[][]
%\captionsetup[equ]{labelformat=empty}
\begin{document}
Some text
\begin{equ}[!ht]
\begin{equation}
a=b+c
\end{equation}
\caption{Caption of the equation}
\end{equ}
Some other text
\end{document}
More details of the commands used from package caption: here.
A screenshot of the output of the above code: