2

I am writing a technical manual for a CAPSTONE project, and I am using the refman package. The refman package divides your document into a left and right hand side. The right hand side contains the text, and the left hand side allows you to put warning indicators, tip symbols or refer to other section. All these symbols in the default form use standard LaTeX elements like \rightarrow.

I am trying to modify this so I can include a picture of a lightbulb. Looking in the refart.cls document I have found the function definitions for the attention symbol:

\newcommand*{\attention}[1][\attentionsymbol]
    {\mbox{}\marginpar{\raggedleft #1}}
\newcommand*{\attentionsymbol}{\large\bfseries ! $\rightarrow$}

How do I change those definitions so I can include an image that I have on my computer?

I have already tried a solution similar to this:

Passing image path to \includegraphics using a macro

whereby you create a new function that generates the image, but I could not get it to work.

1 Answer 1

2

Below I define \imgattention which sets an image (example-image), but this is changable via an optional argument:

enter image description here

\documentclass{refart}

\usepackage{lipsum,graphicx}

\newcommand{\imgattention}[1][example-image]
  {\attention[{\includegraphics[height=.7\baselineskip]{#1}}]}

\begin{document}

\lipsum[1]

\attention
  Some regular text.

\attention[Wow!]%
  Some regular text.

\attention[{\includegraphics[height=.7\baselineskip]{example-image}}]%
  Some regular text.

\imgattention
  Some regular text.

\imgattention[example-image-a]%
  Some regular text.

\lipsum[2]

\end{document}
4
  • That's great! That works well and it makes sense to me now. Do you know how I could change the function so that I can enlarge the image on the left and the corresponding text on the right would move lower? The problem now if I make the image on the left column nice and big it will collide with text above it, but the function aligns the image with the text on the right. I've attached a link overleaf.com/read/wqttjkcqpvhf Nov 21, 2016 at 6:36
  • @silver_turtle: Precede the use of \imgattention by \vspace*{2\baselineskip}.
    – Werner
    Nov 21, 2016 at 6:53
  • Is there a way to change the format so the text in the right hand column still begins at the top of the image? Right now the image takes up "x" lines on the LHS and the text on the RHS also only starts on line "x". I want the text to be aligned with the top of the image Thanks so much for your help Nov 21, 2016 at 20:20
  • Add \usepackage[export]{adjustbox} to your preamble and add to the \includegraphics inside \imgattention as the last option valign=t.
    – Werner
    Nov 21, 2016 at 20:25

You must log in to answer this question.

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