Looking for a way to put a vertical line over another character. Similar to the \cancel feature, but with a vertical, rather than a slanted line. For example on a capital S the vertical line would turn it into something akin to a US dollar symbol: $. (verticallity in this text box seems dependent upon font choice) i.e. superimpose a | over a C

  • tex.stackexchange.com/a/21647/15925 provides a general solution to this – Andrew Swann May 21 '14 at 18:34
  • While you could use \newcommand{\vertchar}[1]{\ooalign{#1\cr\hidewidth$|$\hidewidth}} with \vertchar{s} and \vertchar{c} (say), it doesn't really look nice with \vertchar{S} and \vertchar{C}. Could you be specific in terms of your actual usage? – Werner May 21 '14 at 18:34
  • Usage is in a review article I'm typing for a prof. The hand written symbol looks like the two vert/C's in Oberdiek's example below. I was able to make the \mathclap command work, actually coupled with a \mathcal to achieve an agreeable symbol. This does tend to crowd a preceding (, but adding \hspace*(.01in) spaced things nicely. I'm going to experiment with the others shown here. Thanks Swann. – TommyK May 22 '14 at 13:28
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – samcarter_is_at_topanswers.xyz Oct 2 '17 at 18:58

The following solution uses TikZ (more configuration options as rounded line caps, ...). The optional argument of \vertchar allows horizontal fine tuning:

    inner sep=0pt,
    shorten >=-.15ex,
    shorten <=-.15ex,
    line cap=round,
    (0,0) node (c) {#2}
    ($(c.south)+(#1,0)$) -- ($(c.north)+(#1,0)$);%
  \vertchar{S} and \vertchar{C} or \vertchar[.08ex]{C}


| improve this answer | |

\stackinset allows you do do this with the syntax


The inset and base can be glyphs, phrases, images, anything that can be set into a LaTeX box. The H-anchors are l, c, or r. The V-anchors are t, c, or b. You can stack math by default by issuing \stackMath, which is done for the 2nd example of the MWE, where I simulate an @ symbol by insetting a math a inside a math O.


enter image description here

The insets can be nested to inset multiple things over one base, such as in this answer: Mathematical formulas on a graph (not made by TeX)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.