14

I want to cut off the very top left part of an uppercase R. I tried using \adjustbox, but it cuts off the whole top part, which is not what I want. Here's the MWE, the corresponding output and the desired output.

MWE:

\documentclass{article}
\usepackage{adjustbox}
\begin{document}
\adjustbox{trim = 0pt -.5pt 0pt .5pt, clip}{R}
\end{document}

Corresponding output:

enter image description here

Desired output:

enter image description here

14

You can do this with \adjustbox, but because it can only clip rectangular areas you'll need to create two clippings and place them next to each other.

I'm using two \adjustboxes below: the first just shows the leftmost 0.175em of the “R”, with the top 0.1em cut off, and the second one shows the remainder of the letter. I've \fboxed the letters to show that their bounding boxes are identical and I've converted the pdf to a png with transparency to demonstrate that I'm not covering anything up :).

\documentclass{article}

\usepackage{adjustbox}
\newcommand*\clippedR{%
  \adjustbox{viewport = {0em} {-.95em} {.175em} {\dimexpr\height-.1em}, clip,set depth=0pt}{R}%
  \adjustbox{viewport = {.175em} {-.05em} {\width} {\height}, clip,set depth=0pt}{R}%
}

\begin{document}

\fbox{R}
\fbox{\clippedR}

\end{document}

output

Note that \height, \width and \depth can be used to refer to the original dimensions of the letter (see the adjustbox documentation) and that \dimexpr can be used to perform computations with dimensions (see the etex documentation, §3.5 as of this writing). The % at the end of these lines are necessary because single newlines are normally interpreted as spaces (see this answer).

  • 2
    The only solution which is not a hack, +1! – CarLaTeX Feb 13 '19 at 17:52
  • 1
    The only solution that actually clips instead of covers, +1! – Pippip19 Feb 13 '19 at 18:05
  • 1
    Nice answer! I'm just wondering if one could use a unit like em instead of pt to make it independent of the currently employed font size? – foo Feb 14 '19 at 15:16
  • 1
    @foo You definitely can, and I probably should have. I wasn't thinking as much about creating the symbol as I was thinking about demonstrating how \adjustbox can be used. – Circumscribe Feb 14 '19 at 21:00
  • 2
    @foo: Switched from pt to em, because you're right. – Circumscribe Feb 14 '19 at 21:27
10

What works with make-up also works for tex: instead of removing the corner of the R, cover it up:

\documentclass{standalone}
\usepackage{xcolor}

\begin{document}

{    
    \leavevmode\rlap{R}\rlap{\kern-0.02em\textcolor{white}{\raisebox{0.5em}{\rule{0.2em}{0.25em}}}}
}

text

\end{document}

enter image description here

6

A possible solution is to simply draw over that corner using tikz:

\documentclass{article}
\usepackage{tikz}
% Lengths used to hold Height/Width of `R' in current font
\newlength{\uppercaseHeight}
\newlength{\uppercaseWidth}
% R with a corner missing
\newcommand\cutR{%
% Save hieght and width of current R (depends on fontsize)
\settoheight{\uppercaseHeight}{R}%
\settowidth{\uppercaseWidth}{R}%
R% Print R
% Overlay a white rectangle
\tikz[baseline,overlay] \fill [white] % [red] % useful to use a red box when tweaking
(-\uppercaseWidth, 0.8*\uppercaseHeight) rectangle ++(0.24*\uppercaseWidth, 0.25*\uppercaseHeight);
}
\begin{document}\noindent
\small X \cutR X \\
\normalsize X \cutR X \\
\large X \cutR X
\end{document}

Output: output

The values used in the fill command appear to work fairly well for the default font over a range of sizes, but you may want to adjust them to get things looking exactly as intended.

  • thanks. Is it possible to tweak the box so that, if I were to overlay the R with another letter, the box would only cover the R but not the other letter? – noibe Feb 13 '19 at 12:47
  • Definitely. In fact, it is very easy to modify the \cutR command to achieve this. Adding \hspace{-\uppercaseWidth}X immediately after the call to \tikz (put a % at the end of the tikz command to be sure) for example will result in an X being printed exactly on top of the cut R. – Pippip19 Feb 13 '19 at 14:02
6
\documentclass{article}
\usepackage{xcolor,stackengine}
\begin{document}
\stackinset{l}{}{t}{-.1pt}{\color{white}\rule{1.8pt}{1pt}}{R}
\end{document}

enter image description here

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.