8

Please, is it possible to do this in Latex? Thank you.enter image description here

Ashrak
  • 539

2 Answers2

15

By way of explanation, I build the top of the page with a stack. Some of the finer points of what I am doing are as follows:

  • the \fboxsep is the border padding of the box around the "M". If positive, the black box gets too wide, so I set it to 0pt. However, to retain an appropriate height to the black box, I make sure to add a \strut to the box containing the "M".

  • The \noindent keeps the rule from being indented.

  • the \stackalignment says that the stack (in this case, a word under a rule) is right aligned. I used \def rather than \renewcommand because I am a lazy typist and saved a few strokes.

  • the default gap between short-stacked items is 3pt. But I wanted no gap between the rule and the underword. So I used the optional argument [0pt] to indicate that the stack should be built with no gap between the items.

  • I enclose the whole construct in its own brace-delimited group, so that parameters like \fboxsep and \stackalignment revert to their prior values when done with the construct.


\documentclass{article}
\usepackage{xcolor,lipsum,stackengine}
\begin{document}
{\sffamily\fboxsep=0pt\noindent\Huge\def\stackalignment{r}%
\stackunder[0pt]{\rule{\textwidth}{2pt}}{\colorbox{black}{\strut\color{white}M}argin\'alia}}

\bigskip\lipsum[1]
\end{document}

enter image description here

If \bfseries is included immediately after the \sffamily, the result is this:

enter image description here

  • And what about changing color only in the overlapping part of two letters just by LaTeX means? For example in this case, is it possible to make visible not only the "negative space"?: \scalebox{1.5}{O}\makebox[-7pt]{\color{white}C} – Andrestand Sep 30 '15 at 09:53
  • @Andrestand I am not quite sure I understand the gist of your question. In fact, I will go further and say that I don't understand what you are asking. – Steven B. Segletes Sep 30 '15 at 10:11
  • 1
    @Andrestand I see that you have overlaid a white "C" atop a larger "O". I used that as part of an answer here: http://tex.stackexchange.com/questions/122970/simulate-printing-imperfections-and-defects-with-tex/123102#123102. But I am trying to understand how it applies to this question. – Steven B. Segletes Sep 30 '15 at 10:15
  • We will need some kind of mask, and then overlapping two C's, one white, and one black, with the O mask. – Andrestand Sep 30 '15 at 11:01
  • @Andrestand If you are asking if multiple objects can be stacked, yes they can. Here is an example: \documentclass{article} \usepackage{stackengine,xcolor} \begin{document} \stackinset{c}{-2pt}{c}{}{\textcolor{red}{C}}{\stackinset{c}{+2pt}{c}{}{\textcolor{blue}{C}}{\LARGE O}} \end{document} – Steven B. Segletes Sep 30 '15 at 11:13
  • That's a more automatic way of overlapping than mine, but the point is making white the overlapped part, the intersection of the stacked letters. – Andrestand Sep 30 '15 at 11:50
  • 1
    @Andrestand Now it is becoming more clear. You would like overlapping letters, where only the overlapped section is white and everything else is black. I do not think my method will achieve that, because it lays a glyph at a time, whereas what you need is part of the glyph one color and part another color. – Steven B. Segletes Sep 30 '15 at 11:52
  • 1
    @Andrestand Perhaps this question would be of interest: http://tex.stackexchange.com/questions/180510/how-to-get-intersection-points-of-two-glyphs – Steven B. Segletes Sep 30 '15 at 12:00
3

If I assume @Torbjorn T. understood your question right, the color-package should help.

\documentclass{article}
\usepackage{color}
\begin{document}        
\colorbox{black}{\color{white}Some Text.}
\end{document}