Missing } inserted Latex - latex

\begin{equation}
\tau _{2}(r_{0})=\left\{\begin{matrix}
\frac{R^{d}-r_{c}^{d}}{D_{1}}\frac{r_{0}^{-1}-a^{-1}}{-3} \\
\frac{R^{d}-r_{c}^{d}}{D_{1}}\frac{r_{c}^{-1}-a^{-1}}{-3}
\end{matrix}\right.
\end{equation}
Basically I am wrtting an equation in Latex which should be displayed in the form
But Latex reports error "Missing } inserted" on the third line. What is the problem? Thanks a lot!

The cases environment from the amsmath package exists for exactly this purpose:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\tau_{2}(r_{0}) =
\begin{cases}
\frac{R^{d}-r_{c}^{d}}{D_{1}}\frac{r_{0}^{-1}-a^{-1}}{-3} \\
\frac{R^{d}-r_{c}^{d}}{D_{1}}\frac{r_{c}^{-1}-a^{-1}}{-3}
\end{cases}
\end{equation}
\end{document}
This also makes it easy to add description, e.g.
\begin{equation}
\tau_{2}(r_{0}) =
\begin{cases}
\frac{R^{d}-r_{c}^{d}}{D_{1}}\frac{r_{0}^{-1}-a^{-1}}{-3} & \text{if } c = 0\\
\frac{R^{d}-r_{c}^{d}}{D_{1}}\frac{r_{c}^{-1}-a^{-1}}{-3} & \text{otherwise} \\
\end{cases}
\end{equation}

I made some changes to the equation and this works. Not sure if it is what you were trying to achieve
\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\begin{document}
\title{Introduction to \LaTeX{}}
\author{Author's Name}
\maketitle
\[
\tau _{2}(r_{0})= \left[
\begin{array}{ccc}
\dfrac{R^{d}-r_{c}^{d}}{D_{1}} & \dfrac{r_{0}^{-1}-a^{-1}}{-3}\\
\dfrac{R^{d}-r_{c}^{d}}{D_{1}} & \dfrac{r_{c}^{-1}-a^{-1}}{-3}
\end{array}
\right]
\]
\end{document}

Related

I want to have a new environment with 7 arguments. What is the problem here?

I want to have a new environment with 7 arguments. What is the problem here? Please help. Each time it is showing error: "llegal character in array arg." and "You can't use `macro parameter character #' in restricted horizontal mode."
\documentclass{article}
\usepackage[margin=1in, a4paper]{geometry}
\usepackage{titlesec}
\usepackage{fontspec}
\usepackage{comment}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{bengali}
\setmainfont{Times New Roman}
\newfontfamily\bengalifont[Script=Bengali]{Kalpurush}
\makeatletter
\renewcommand{\#seccntformat}[1]{}
\makeatother
\newenvironment{word}[8]% environment name
{
\begin{tabular}{c c c c c c c}
\fbox{#1} & \textit{#2} & --- & \multicolumn{4}{#3}\\
& & & \multicolumn{4}{#4}\\
\hline
& & & #5 & #6 & #7 & #8\\
\hline
\end{tabular}
}
{}
\title{Words}
\author{}
\date{January 2023}
\begin{document}
\maketitle
\section{11/01/2023}
\begin{word}{654}{respite}{A (temporary) relief from harm or discomfort/A pause for relaxation/The art of reprieving; postpone or remitting punishment}{}{}{}{}{}\end{word}
\end{document}
The syntax \multicolumn{...}{...} is wrong. \multicolumn has three mandatory arguments, not just two.
\documentclass{article}
\usepackage[margin=1in, a4paper]{geometry}
\usepackage{titlesec}
%\usepackage{fontspec}
\usepackage{comment}
%\usepackage{polyglossia}
%\setmainlanguage{english}
%\setotherlanguage{bengali}
%\setmainfont{Times New Roman}
%\newfontfamily\bengalifont[Script=Bengali]{Kalpurush}
\makeatletter
\renewcommand{\#seccntformat}[1]{}
\makeatother
\NewDocumentEnvironment{word}{mmmmmmmm}{
\begin{tabular}{c c c c c c c}
\fbox{#1} & \textit{#2} & --- & \multicolumn{4}{p{6cm}}{#3}\\
& & & \multicolumn{4}{c}{#4}\\
\hline
& & & #5 & #6 & #7 & #8\\
\hline
\end{tabular}
}
{}
\title{Words}
\author{}
\date{January 2023}
\begin{document}
\maketitle
\section{11/01/2023}
\begin{word}{654}{respite}{A (temporary) relief from harm or discomfort/A pause for relaxation/The art of reprieving; postpone or remitting punishment}{}{}{}{}{}\end{word}
\end{document}

Missing control sequence inserted. \end{tabulary} error in revtex4-2 template aps

I am writing a paper in APS journal template : revtex4-2, when I import my table I have this error :
Missing control sequence inserted. \end{tabulary}. But this table has no problem in other template for example IEEE. I dont know how fix it. I really appreciate any help.
\documentclass[aps,pra,twocolumn,floatfix,footinbib,notitlepage,superscriptaddress,groupaddress,showpacs]{revtex4-2}
\usepackage{graphicx,graphics,times,bm,bbm,bbold,amssymb,amsmath,amsfonts,dsfont,hyperref,mathrsfs,color,caption,subcaption,cancel}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}
\begin{document}
\preprint{AIP/123-QED}
%\title[Sample title]{Sample Title:\\with Forced Linebreak\footnote{Error!}}% Force line breaks with \\
\title[]
\author{}
\affiliation{}
\author{}
\affiliation{}
\email{}
\date{\today}
\begin{abstract}
\end{abstract}
% \keywords{}
% \maketitle
\section{Introduction}\label{sec:introduction}
\section{Theoretical Analysis}
\begin{table}[h!]
\centering
\caption{List of Parameters Values }
\label{table:1}
\begin{adjustbox}{max width=8.5 cm}
\begin{tabulary}{\columnwidth}{#{}llr#{}}
\toprule
\textbf{Parameters} & \textbf{Values} & \textbf{Units}\\
\midrule
$\lambda$ & 1550 & $nm$ \\
\bottomrule
\end{tabulary}
\end{adjustbox}
\end{table}.
\end{document}
%
% ****** End of file aipsamp.tex ******
I suggest the new and much more flexible tabularray package instead.
Also don't scale content which contains text, this will result in an suboptimal result. If in your real document, you must make the table smaller, use a smaller font size instead of scaling it with adjustbox.
(you should really clean up your preamble and remove duplicates and outdated packages)
\documentclass[aps,pra,twocolumn,floatfix,footinbib,notitlepage,superscriptaddress,groupaddress,showpacs]{revtex4-2}
\usepackage{graphicx,graphics,times,bm,bbm,bbold,amssymb,amsmath,amsfonts,dsfont,hyperref,mathrsfs,color,caption,subcaption,cancel}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\preprint{AIP/123-QED}
%\title[Sample title]{Sample Title:\\with Forced Linebreak\footnote{Error!}}% Force line breaks with \\
\title[]
\author{}
\affiliation{}
\author{}
\affiliation{}
\email{}
\date{\today}
\begin{abstract}
\end{abstract}
% \keywords{}
% \maketitle
\section{Introduction}\label{sec:introduction}
\section{Theoretical Analysis}
\begin{table}[h!]
\centering
\caption{List of Parameters Values }
\label{table:1}
% \begin{adjustbox}{max width=8.5 cm}
\begin{tblr}{width=0.8\linewidth,colspec={#{}X[l]X[l]X[r]#{}}}
\toprule
\textbf{Parameters} & \textbf{Values} & \textbf{Units}\\
\midrule
$\lambda$ & 1550 & $nm$ \\
\bottomrule
\end{tblr}
% \end{adjustbox}
\end{table}
\end{document}
%
% ****** End of file aipsamp.tex ******

`\newtheorem{thm}{Theorem}` without each line being numbered?

I want to use \newtheorem{thm}{Theorem} but do not want each line to be enumerated. For example
\documentclass{article}
\usepackage[utf8]{inputenc}
\title{Addition}
\date{January 2022}
\newtheorem{thm}{Theorem}
\begin{document}
\maketitle
\begin{thm}
Addition.
\begin{proof}
\begin{align}
a + b &= b + a\\
\end{align}
\end{proof}
\end{thm}
\end{document}
This would create something like
Theorem 3. Addition example
Proof.
a + b = b + a (1.1)
However, I do not want the (1.1) part, how do I remove it? Have tried this but the numbering is still added. Anyone know how to remove it?
You can use align* to suppress the numbering:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsthm,mathtools}
\title{Addition}
\date{January 2022}
\newtheorem{thm}{Theorem}
\begin{document}
\maketitle
\begin{thm}
Addition.
\begin{proof}
\begin{align*}
a + b &= b + a\\
\end{align*}
\end{proof}
\end{thm}
\end{document}

Making a letter head for certificate page of thesis

I am trying to make a letter head to make a certificate to put in a thesis. I have posted the MWE below.
There are 2 issues I need help with
The cell alignment of the letterhead, is not proper. I am not sure how to correct it.
I need the double lines to be in red colour, I wasn't able to get it.
The final output should be something like this image
enter image description here
\documentclass[12 pt,a4 paper]{article}
\usepackage[top=1cm,left=1in,right=1 in,bottom=1in]{geometry}
\usepackage{times}
\usepackage{graphicx}
\usepackage{marvosym}
\usepackage[onehalfspacing]{setspace}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{fancyhdr}
\usepackage{xcolor}
\pagestyle{fancy}
\usepackage{multirow}
\fancyhf{}
\noindent
\makebox[0pt][l]{\rule[.7ex]{\linewidth}{#1}}%
\rule[.3ex]{\linewidth}{#1}}
\begin{document}
\pagestyle{empty}
\vspace{12 mm}
\begin{tabular}{c c c}
\multicolumn{1}{r}{{\Large Bangalore}} & \multirow{1}{*}{\includegraphics[width=0.175\linewidth]{BUB_Emblem}} & \multicolumn{1}{l}{{\Large University}}\\
%\multicolumn{1}{r}{\Huge{Bangalore}} & \multirow{1}{*}{\includegraphics[width=0.15\linewidth]{BUB_Emblem}} & \multicolumn{1}{l}{\Huge{University}}\\
\large{Dr Vijaykumar H Doddamani} & & \multicolumn{1}{l}{Department of Physics} \\
\multicolumn{1}{r}{M.Sc., M. Phil., PhD} && \multicolumn{1}{l}{Ph. Off: 080-22961471/84} \\
&&\multicolumn{1}{l}{Fax: 080-23219295}\\
\multicolumn{1}{l}{\textbf{\large Professor}} & & \multicolumn{1}{l}{Mobile : 9481300346} \\
\multicolumn{1}{l}{Email: drvkd#gmail.com} & Jnanabharathi Campus & \multicolumn{1}{l}{Mobile : 9448673274} \\
\multicolumn{1}{r}{profvijaykumarhd#bub.ernet.in} & Bengaluru - 560 056 & \multicolumn{1}{l}{WhatsApp :9741716744} \\
%
\end{tabular}
\vskip2mm
\vspace{2mm}
\doublerule[1pt]
\end{document}
With this code, This is the output I am getting.
enter image description here
I have put in the arrows and comments in this imagearrows and comments for width alinment
\documentclass[12 pt,a4 paper]{article}
\usepackage[top=1cm,left=1in,right=1 in,bottom=1in]{geometry}
\usepackage[table]{xcolor}
\usepackage{times}
\usepackage{graphicx}
\usepackage{marvosym}
\usepackage[onehalfspacing]{setspace}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{multirow}
\fancyhf{}
\newcommand{\doublerule}[1][.4pt]{%
\noindent%
\makebox[0pt][l]{\rule[.7ex]{\linewidth}{#1}}%
\rule[.3ex]{\linewidth}{#1}}
\begin{document}
\pagestyle{empty}
\vspace{12 mm}
\centerline{%
\makebox[\paperwidth]{%
\begin{tabular}{#{\hspace{.08\paperwidth}} p{.32\paperwidth} p{.2\paperwidth} p{.32\paperwidth} #{\hspace{.08\paperwidth}} }
\multicolumn{1}{#{}r#{}}{\Large Bangalore} & \centering\multirow{1}{*}{\includegraphics[width=.9\linewidth]{example-image-duck}} & \Large University\\
\multicolumn{1}{#{}r#{}}{\large Dr Vijaykumar H Doddamani} & & Department of Physics\\
\multicolumn{1}{#{}r#{}}{M.Sc., M. Phil., PhD} && Ph. Off: 080-22961471/84 \\
&&Fax: 080-23219295\\
\textbf{\large Professor} & & Mobile : 9481300346 \\
Email: drvkd#gmail.com & \centering Jnanabharathi Campus & Mobile : 9448673274 \\
\hphantom{Email:} profvijaykumarhd#bub.ernet.in & \centering Bengaluru - 560 056 & WhatsApp :9741716744 \\[2mm]
\arrayrulecolor{red}\hline\hline
\end{tabular}%
}}
\end{document}

Comments in LaTeX break pandoc table

Pandoc is unable to convert LaTeX tables with an "% END" comment:
\documentclass{article}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|l|l|l|}
a & a & a \\
a & a & a \\
a & a & a \\
% END
\end{tabular}
\caption{example}
\label{tab:example}
\end{table}
\end{document}
The same example without the comment works fine.

Resources