Turning off marginpar (marginparwidth) while in multicols environment - latex

I'm trying to turn off marginpar when starting a new multicols environment with this:
\renewenvironment{multicols}[1]{%
\let\oldmarginparwidth\marginparwidth
\setlength{\marginparwidth}{0}%
\begin{multicols}{#1}
}{%
\end{multicols}%
\setlength{\marginparwidth}{\oldmarginparwidth}%
}
However, it doesn't work. What am I missing?

The command you've got there won't work mid-page, you need to use the changepage package to do that.
\usepackage{changepage}
I take it you're trying to take up the full width of the page. I nicked this from the tufte-latex class:
First, define an 'overhang' amount that'll be added to the textwidth at the beginning and subtracted at the end:
\newlength{\overhang}
\setlength{\overhang}{\marginparwidth}
\addtolength{\overhang}{\marginparsep}
Then use \adjustwidth with the overhang amount when you want to remove marginpar space:
\begin{adjustwidth}{}{-\overhang}
% This will be displayed full-width
\end{adjustwidth}{}{-\overhang}
As Damien pointed out, you can still use marginpars like this, they'll just exceed the pagewidth. \multicols will prevent you from using floats, however.
Hope that's what you need!

I'm not sure exactly what you're looking for here, but generally marginpars aren't allowed in multicols already. From the multicol documentation:
...floats and marginpars are not allowed in the current implementation [This is dictated by lack of time. To implement floats one has to reimplement the whole LATEX output routine.].

I have managed to get it working by using the chngpage package and defining a new environment which sets/resets different values before/after that environment.
However, I still have a problem on the last page of each \chapter: header width on the last page of the chapter

Related

NBConvert PDF/Latex page formatting IPython

Got some good advice on suppressing code and other items on NBConvert output,, Here Suppress code in NBConvert? IPython
BUT: now It seems I need to change top and bottom margins And I can see that it seems that it may be set in the sphnix template, (if I even know where it is), which I don't want to mess with but I cannot figure out how to edit the Latex output to get at the margins I attempted to place this in the import headers
\usepackage[margin=0.5in]{geometry}
But nothing happened.. I know squat about latex I am using the TexStudio package to modify the Latex output of NB convert, but at this point I don't see something to modify for margins...
I'm trying to touch up some page flow issues involving placement of output graphs that are just too big so I end up with big ugly blank spots,, pretty sure that if I can get at the margins I can...
To change the margins using your proposed code, you have to put this line after the other inputs, e.g. about line 71. If you put it at the top, it will be overridden by another call. With my notebook this works fine.
I'm pretty sure you know you can specify different margins using
\usepackage[left=0.5in, right=0.5in, top=0.5in, bottom=0.5in]{geometry}
see e.g. wikibooks.
Btw. be aware that the sphinx based templates are removed in current master. The new templates are much more customizable and remove some issues due to the mdframed packages (GitHub Issue)

Figure spanning full width of page in two-column article

In a IEEEtran latex template, I am trying to put a figure spanning full width of the page.
I am doing,
\begin{figure*}[h]
\centering
\setlength\fboxsep{0pt}
\setlength\fboxrule{0.25pt}
\fbox{\includegraphics[width=6.2in]{Figure7}}
\caption{Figure}
\label{f7}
\end{figure*}
This places the image on a new page at the end of the article. How do I place it where it should be?
Thanks
For starters I might try to put the figure* block further up in the document, just to check that LaTeX isn't placing it there for a logical reason.
If that doesn't work, I would remove all extraneous commands in the figure* block to be sure they aren't causing problems.
Finally I might try using a figure that doesn't need resizing, or use [width=0.9\linewidth] just to check; sometimes figures that are "too big" can get bumped to the end of the document.
Edit: You may also try using (temporarily) a different template. For example I know that revtex4-1 has a figure* environment that behaves the way to want, to check if ieeetran is the problem or perhaps if that is part of their style.
the problem is the [h].
get rid of that, it'll work.

How to change the font size of line numbers using the Minted Latex Package

I tried redefining the \FancyVerbLine to have a \large, but that didn't help. Is there another way to do this?
That should do the trick. How exactly does your \FancyVerbLine look like? Notice that it’s not enough to put the formatting in – you also need to include the counter command:
\renewcommand\theFancyVerbLine{\large\arabic{FancyVerbLine}}
This should work.

Automatically QED in LaTeX's newtheorem command

As the title says I need to define a QED symbol automatically (preferable a colorbox) at the end of my custom newtheorem.
Any suggestions would be appreciated.
Advice: don't do it. The placing of the QED symbol depends in a non-straightforward way on the contents of your text in your environment. For instance, Andrea's code will fail if your theorem ends with display math. You will probably need to place it by hand sometimes, and you are less likely to overlook things if you always do this.
Much better would be to have an environment that complains if the QED symbol has not been placed. You can do this by defining a qedused flag, say by \newififqedused, that is unset when you enter the environment (define a wrapper using \newenvironment as Andrea said), set in a wrapper around the QED symbol, and tested when you exit the environment. If the flag is still unset on exit, issue a \PackageWarning or \PackageError.
If you really want to try to get a qed environment that tries hard to do the right thing, regardless of what is in the environment, you'll need to look into the contents of \lastbox to try to determine where the QED symbol should go. If it is an hbox, you are fine, just place the QED as per Andreas' solution. If it is an mbox, then I think making an hbox containing this mbox followed by the QED symbol should work - I'm not sure, I don't usually mess about with the typesetting of maths.
If it is a vbox, you need to look inside the structure of the vbox to find where it should go, which sounds hard - I can't think how to do that in pure Tex. In Luatex, I think that Hans Hagen's trick in The LuaTEX way: \framed might be adapted for this.
I'm not sure what you mean. If you use the package amsthm you have the command \qed to put a QED wherever you want.
You can customize the \qed by changing the command \qedsymbol. So you would do something like
\usepackage{amsthm}
\renewcommand{\qedsymbol}{$\heartsuit$}
\newtheorem{thm}{Theorem}
\newenvironment{\mythm}{\begin{\thm}}{\qed \end{thm}}
...
\begin{mythm}
blah
\end{mythm}
This if you want the QED symbol to be the same that appears in proofs. If not you can do simply
\newtheorem{thm}{Theorem}
\newenvironment{\mythm}{\begin{\thm}}{\hfill $\heartsuit$ \end{thm}}
...
\begin{mythm}
blah
\end{mythm}
Of course you can change \heartsuit with whatever you want.
An alternative is to use the ntheorem package with the options thmarks. that is \usepackage[thmarks]{ntheorem}.
You can then play with the settings to get what you want exactly...

Adding MS-Word-like comments in LaTeX

I need a way to add text comments in "Word style" to a Latex document. I don't mean to comment the source code of the document. What I want is a way to add corrections, suggestions, etc. to the document, so that they don't interrupt the text flow, but that would still make it easy for everyone to know, which part of the sentence they are related to. They should also "disappear" when compiling the document for printing.
At first, I thought about writing a new command, that would just forward the input to \marginpar{}, and when compiling for printing would just make the definition empty. The problem is you have no guarantee where the comments will appear and you will not be able to distinguish them from the other marginpars.
Any idea?
todonotes is another package that makes nice looking callouts. You can see a number of examples in the documentation.
Since LaTeX is a text format, if you want to show someone the differences in a way that they can use them (and cherry pick from them) use the standard diff tool (e.g., diff -u orig.tex new.tex > docdiffs). This is the best way to annotate something like LaTeX documents, and can be easily used by anyone involved in the production of a document from LaTeX sources. You can then use standard LaTeX comments in your patch to explain the changes, and they can be very easily integrated. If the document lives in a version control system of some sort, just use the VCS to generate a patch file that can be reviewed.
I have used changes.sty, which gives basic change colouring:
\added{new text}
\deleted{old text}
\replaced{new text}{old text}
All of these take an optional parameter with the initials of the author who did this change. This results in different colours used, and these initials are displayed superscripted after the changed text.
\replaced[MI]{new text}{old text}
You can hide the change marks by giving the option final to the changes package.
This is very basic, and comments are not supported, but it might help.
My little home-rolled "fixme" tool uses \marginpar where possible and goes inline in places (like captions) where that is hard to arrange. This works out because I don't often use margin paragraphs for other things. This does mean you can't finalize the layout until everything is fixed, but I don't feel much pain from that...
Other than that I heartily agree with Michael about using standard tools and version control.
See also:
Tips for collaboratively editing a LaTeX document (which addresses you main question...)
https://stackoverflow.com/questions/193298/best-practices-in-latex
and a self-plug:
How do I get Emacs to fill sentences, but not paragraphs?
You could also try the trackchanges package.
You can use the changebar package to highlight areas of text that have been affected.
If you don't want to do the markup manually (which can be tedious and interrupt the flow of editing) the neat latexdiff utility will take a diff of your document and produce a version of it with markup added to visually display the changes between the two versions in the typeset output.
This would be my preferred solution, although I haven't tested it out on large, multi-file documents.
The best package I know is Easy Review that provides the commenting functionality into LaTeX environment. For example, you can use the following simple commands such as \add{NEW TEXT}, \remove{OLD TEXT}, \replace{OLD TEXT}{NEW TEXT}, \comment{TEXT}{COMMENT}, \highlight{TEXT}, and \alert{TEXT}.
Some examples can be found here.
The todonotes package looks great, but if that proves too cumbersome to use, a simple solution is just to use footnotes (e.g. in red to separate them from regular footnotes).
Package trackchanges.sty works exactly the way changes.sty. See #Svante's reply.
It has easy to remember commands and you can change how edits will appear after compiling the document. You can also hide the edits for printing.

Resources