1

I drew a glucose molecule (in its chair conformation) with the package tikz. And then I took a screenshot and edited it. After this I inserted this picture into my LaTeX document. The problem is the following: I would like the picture to start from the very left edge of the paper but unfortunatelly, it is not that easy for me because there is always a white space (about 1-2 cm). How to change this space to 0 cm?

A picture of my problem:

Part of glucose

Here is the code:

\documentclass[12pt,a4paper]{article}
\usepackage[magyar]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz,chemfig,mathtools,amsmath,amsfonts,amssymb,fullpage,graphicx,xcolor,cancel}
\usepackage[outline]{contour}
\definecolor{zold}{HTML}{99FF99}


\begin{document}
\begin{titlepage}
\vspace*{5cm}
\begin{center}
\textsc{\Huge Title}\\
\vspace*{1cm}
\textsc{\Large Author}\\
\begin{figure}[h]
\includegraphics[width=18cm]{nagyglcc2.png}
\end{figure}
\end{center}
\end{titlepage}
  • 2
    My crystal ball is showing nothing but dense haze at the moment. :-( It would be truly helpful if you showed the code that gives rise to the issue you're looking to fix. – Mico Oct 23 '16 at 19:53
  • 1
    If adding \noindent immediately before the tixzpicture does not resolve the issue then, the problem is in how you are drawing the picture. You can try adding a bounding box to see the actual edges of the picture. For example, see Bounding box is larger than expected when drawing a curved path. Otherwise, please post the a complete MWE including \documentclass and the appropriate packages that reproduces the problem. – Peter Grill Oct 23 '16 at 19:59
  • Is the white space to the left by any chance of the same size than the margin? – samcarter_is_at_topanswers.xyz Oct 23 '16 at 21:24
  • 2
    Why are you making a screenshot when you have tikz code? It won't improve the quality. – Ulrike Fischer Oct 23 '16 at 21:27
  • I was probably thinking of the same thing as @samcarter: if you replace \includegraphics[...]{...} with \hspace*{-\dimexpr \oddsidemargin + 1in} \includegraphics[...]{...}, do you get what you want? – GuM Oct 23 '16 at 21:35
2

enter image description here

Is above picture what you looking for? I move it to left paper border with help of changepage package. In MWE I deleted all packages from your MWE, which not contributed to solution and add showframe to see page layout, which I determine by `geometry package:

\documentclass[12pt,a4paper]{article}
\usepackage[margin=30mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[strict]{changepage}
\usepackage{calc}

\usepackage{showframe}% for showing page layout
\renewcommand*\ShowFrameColor{\color{red}}

\begin{document}
\begin{titlepage}
\vspace*{5cm}
    \begin{center}
\textsc{\Huge Title}\\
\vspace*{1cm}
\textsc{\Large Author}\\
    \end{center}
\begin{adjustwidth*}{-\oddsidemargin-1in}{}
    \includegraphics[width=18cm,height=2cm]{example-image}
\end{adjustwidth*}
\end{titlepage}
\end{document}

Note: float (figure) cannot be used inside \begin{center} ... \end{center}. This part of your code I don't understand (if probably you like to add caption to figure, let me know).

| improve this answer | |
  • +1! But may I suggest that you make the first argument of the adjustwidth* environment dinamically conform to the actual margin in force? – GuM Oct 23 '16 at 21:47
  • Indeed, I’ve tried it and \begin{adjustwidth}{-\dimexpr \oddsidemargin + 1in}{} seems to work fine! (:-) – GuM Oct 23 '16 at 21:55

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.