Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Can I insert a graphic in-line in a sentence?


Use case: I'm writing a manual that involves navigating the Windows Start Menu. I would like to insert a little graphic of the start menu in-line in the text. I am aware of a sparklines package that does something similar, but have not been able to distill that to a simple example.

Is there a macro or command that can help with this?

In addition (and I hope this is a valid part of the question, but am happy to post it as a new question) I would like a shortcut or command to display the Windows Start Menu plus n steps of navigation, so I could write the following:

Some paragraph and then \WinMenu{Start}{Programs}{Foo}{Bar}{Baz.exe} and then more text.

or

Lorem ipsum \WinMenu{Programs,Foo,Bar,Baz.exe} and then more text.

or something similar, and the result in the PDF will be stylized somehow, with the little Start Menu box icon (shown as "GRAPHIC" below), and then, for example, in bold or \tttext fonts, GRAPHIC > Foo > Bar > Baz.exe as part of and embedded in the existing sentence.

share|improve this question
add comment

4 Answers

up vote 11 down vote accepted

Here is one way to do it. I took the liberty to add some formatting, but feel free to change it as you wish:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}

\newcommand*{\WineMenuColor}{black}%
\newcommand*{\StartMenu}{\includegraphics[scale=0.2]{StartIcon}}%
\newcommand*{\WinMenu}[1]{%
\StartMenu %
\foreach \x in {#1} {%
    $\boldsymbol{\textcolor{\WineMenuColor}{>}}$ \texttt{\textcolor{\WineMenuColor}{\x}}%
}}%

\begin{document}
Lorem ipsum \WinMenu{Programs,Foo,Bar,Baz.exe} and then more text.
\end{document}

enter image description here

share|improve this answer
    
Thanks. This is a good solution. I will post my version (based off an earlier version of yours) for reference. –  mankoff Sep 19 '11 at 14:49
add comment

Based on the selected answer by @Peter I implemented it like so. Please excuse (or edit!) formatting errors below:

\usepackage{tikz}
\newcommand{\StartMenu}{\includegraphics[scale=0.22]{start.pdf}}%
\newcommand{\WinMenu}[1]{%
   \StartMenu
   \texttt{\,Start$>$Programs}%
   \foreach \x in {#1} {%
   \texttt{$>$\x}%    
   }%
}%

It looks better to have the word "Start" be in the same font as the rest of the text. I am also lazy and do not want to type "Start,Programs" each time, so they are hard coded. Use case is: Also, \WinMenu{Foo,Bar,Baz} and some text and result is:

Sample showing WinMenu command

The vertical alignment of the icon is off by a tiny bit, but it is good enough for my purposes.

share|improve this answer
add comment

Not really a solution: use \includegrapchis and play a bit with the picture size. But you have to do it for each font size.

Concerning menu: http://ctan.org/tex-archive/macros/latex/contrib/menu

Menu.sty define a command \menu{Programm!!Menu1!Command} and expand it to something like Programm=>Menu1->Command. You can use it for documentations of programs.

If you solved your main question (inline Micro-graphics) you may combine it with menu.sty.

share|improve this answer
add comment

I just came across the menukeys package. It seems to be designed for this specific use case. Usage examples are also shown on the LaTeX Matters blog.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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