daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Oct 12th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. documentclass{article}
  2.  
  3. usepackage{graphicx, tabularx}
  4. usepackage[nopar]{lipsum}
  5.  
  6. newenvironment{centerentry}[2][]
  7.   {renewcommand{tabularxcolumn}[1]{m{##1}}
  8.    noindent
  9.    tabularx{linewidth}{ @{} m{imagecolwidth} X @{} }
  10.      includegraphics[width=linewidth,#1]{#2} &
  11.   }{%
  12.    endtabularx%
  13.   }
  14. newlength{imagecolwidth}
  15. setlength{imagecolwidth}{2em}
  16.  
  17. sloppy% Just for this example
  18.  
  19. begin{document}
  20. section{Is it possible to get this text line and the two pictures centered?}
  21. begin{centerentry}[height=4ex, width=4ex]{example-image-a} horizontal centered? includegraphics[height=8ex]{example-image-b}\
  22. end{centerentry}
  23. section{This text is centerd to the picture.}
  24. begin{centerentry}[height=4ex, width=4ex]{example-image-a}
  25.  This text is centerd to the picture.
  26. end{centerentry}
  27. section{Third  text is not centerd.}
  28. begin{centerentry}[height=4ex, width=4ex]{example-image-a}
  29.  This text is centerd to the picture.
  30. end{centerentry}
  31. begin{centerentry}[height=4ex, width=4ex]{example-image-a}
  32.  This text is centerd to the picture.
  33. end{centerentry}
  34. begin{centerentry}[height=4ex, width=4ex]{example-image-a} horizontal centered? includegraphics[height=8ex]{example-image-b}\
  35. end{centerentry}
  36. begin{centerentry}[height=4ex, width=4ex]{example-image-a}
  37.  This text is centerd to the picture.
  38. end{centerentry}
  39. begin{centerentry}[height=4ex, width=4ex]{example-image-a}
  40.  This text is centerd to the picture.
  41. end{centerentry}
  42. section{More than one text line: Output is OK. Of course it would be nice if the text is around the picture.}
  43. begin{centerentry}[height=4ex, width=4ex]{example-image-a}
  44.  Write some text to get more lines. Write some text to get more lines. To see. Write some text to get more lines. More lines. Write some text to get more lines. includegraphics[height=8ex]{example-image-b}  Write some text to get more lines. Write some text to get more lines.
  45. end{centerentry}
  46. section{With Photoshop:}
  47. begin{centerentry}[height=4ex, width=4ex]{example-image-a} horizontal centered? includegraphics[height=8ex]{example-image-b}\
  48. end{centerentry}
  49. end{document}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top