1

I am using acm template and want < and > bracket. I checked out some posts regarding this question and they have suggested to use \left and \right. But the problem is when I use them, they give me error saying ! Missing delimiter (. inserted). I want to write html code like <html>.

I do not want the elongated '<' which is a delimiter from mathsymbols. I want the simple '<'.

Here is the sample code

\documentclass[prodmode,acmtecs]{acmsmall}

% Package to generate and customize Algorithm as per ACM style
\usepackage[ruled]{algorithm2e}
\usepackage{listings}
\usepackage{array}
\renewcommand{\algorithmcfname}{ALGORITHM}
\SetAlFnt{\small}
\SetAlCapFnt{\small}
\SetAlCapNameFnt{\small}
\SetAlCapHSkip{0pt}
\IncMargin{-\parindent}

% Document starts
\begin{document}

% Title portion
\title{Some Title}
\author{Some Name
\affil{Some University}}
\maketitle

$\left$ source $\right$
\end{document}

But if I use $\langle$ and $\rangle$ it doesn't give me any error but gives weird left and right angles.

8
  • What do you what to achieve? What do you want to do with the brackets?
    – azetina
    Jun 14, 2012 at 20:17
  • I want to write html code like in <html>. I have edited the question as well! Jun 14, 2012 at 20:20
  • \left and \right are macros that act on extensible delimiters, which you haven't specified. You're perhaps interested in $\left\langle\textrm{source}\right\rangle$?
    – Werner
    Jun 14, 2012 at 20:20
  • Remember that a \left must be accompanied by \right command.
    – azetina
    Jun 14, 2012 at 20:22
  • This definition works for me: \newcommand{\braca}[1]{\ifmmode\left\langle{#1}\right\rangle\else$\left\langle{\text{#1}}\right\rangle$\fi}. You can use it as \braca{html} in text mode or, $\braca{x = y ^2}$ in math mode (assuming you are loading amsmath, if you can \textrm{} instead of \text{}). Jun 14, 2012 at 20:24

1 Answer 1

3

I would suggest creating a command that would represent your HTML tags. Something like \htmltag:

enter image description here

\documentclass{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\newcommand{\htmltag}[1]{%
  \scalebox{.6}[1]{$<$}{\ttfamily#1}\scalebox{.6}[1]{$>$}%
}
\begin{document}
There is \htmltag{source} and also \htmltag{img}.
\end{document}​

graphicx's \scalebox is used to shrink < and > horizontally (to 60% of its original width) while maintaining its vertical height. You can substitute this for any other symbol (like \langle and \rangle) if you wish, and also modify the .6 horizontal scale parameter or remove the scaling altogether. You don't need to resize the delimiters using \left and \right.

For now the contents is set using \ttfamily. However, depending on the usage, you may wish to put it in an \mbox to avoid breaking at the text block boundary if your tags are comprised of multiple words.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .