I am typesetting an A5 document, which includes a music environment as provided by musixtex.
I would like to reduce the linewidth/textwidth of just the music.
Here are a few things, that I have tried:
Put the music inside a minipage. This works fine for short excerpts but for longer music there might be the necessity of a page break, which a minipage doesn't have.
Use the \newgeometry command and subsequently \restoregeometry. That works, but apparently inserts a \newpage, which I also would like to avoid.
Use the changepage package which provides the command \adjustwidth. This works on the left side of the page, but the music then doesn't produce the linebreak at the desired position, but shifted to the right. I provide a MWE of this below.
Use a list-like environment like trivlist or itemize. This works on the left side of the page, but the music then doesn't produce the linebreak at the desired position, but shifted to the right, basically the same as above.
\documentclass{article}
\author{Myself}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{a5paper}
\geometry{twoside}
\geometry{inner=1.375cm}
\geometry{outer=1.375cm}
\geometry{top=1.5cm}
\geometry{bottom=1.5cm}
\usepackage{changepage}
\usepackage{musixtex}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{adjustwidth}{0.5cm}{0.5cm}
\begin{music}
\instrumentnumber{1}
\setstaffs1{1}
\generalmeter{\meterfrac{9}{4}}
\generalsignature{-1}
\nostartrule
\normalmusicsize
\nobarnumbers
\startpiece
\NOtes\qu{ff}\ql{j}\en\bar
\NOtes\qup{h}\cu{g}\qu{fedc}\en
\NOtes\qu{def}\en\bar
\NOtes\hup{gf}\en\rightrepeat
\NOtes\ql{jjj}\en\bar
\NOtes\hlp{k}\qu{h}\ql{ij}\en
\NOtes\qlp{j}\cl{i}\qu{h}\en\bar
\NOtes\hup{g}\qu{cdefgh}\en\bar
\NOtes\hup{gf}\en
\Endpiece
\end{music}
\end{adjustwidth}
\lipsum[2]
\end{document}
To me, both 3) and 4) seem to not work because musixtex doesn't understand/know the new settings for the linewidth etc.
More info: I am aware of the way that musixtex code has to be compiled, I am using a makefile that invokes pdflatex, musixflx and pdflatex again. This is not the cause of the problem.
Any help would be appreciated
You could use tcolorbox to create a breakable box:
\documentclass{article}
\author{Myself}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{a5paper}
\geometry{twoside}
\geometry{inner=1.375cm}
\geometry{outer=1.375cm}
\geometry{top=1.5cm}
\geometry{bottom=1.5cm}
\usepackage{changepage}
\usepackage{musixtex}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\tcolorboxenvironment{music}{breakable,text width=\dimexpr\textwidth-2cm,enhanced,grow to left by=-1cm,colframe=white,colback=white}
\begin{document}
\lipsum[1]
\begin{music}
\instrumentnumber{1}
\setstaffs1{1}
\generalmeter{\meterfrac{9}{4}}
\generalsignature{-1}
\nostartrule
\normalmusicsize
\nobarnumbers
\startpiece
\NOtes\qu{ff}\ql{j}\en\bar
\NOtes\qup{h}\cu{g}\qu{fedc}\en
\NOtes\qu{def}\en\bar
\NOtes\hup{gf}\en\rightrepeat
\NOtes\ql{jjj}\en\bar
\NOtes\hlp{k}\qu{h}\ql{ij}\en
\NOtes\qlp{j}\cl{i}\qu{h}\en\bar
\NOtes\hup{g}\qu{cdefgh}\en\bar
\NOtes\hup{gf}\en
\Endpiece
\end{music}
\lipsum[2]
\end{document}
Related
The template I am using in Latex is as follows:
\documentclass[a4paper,12pt,twoside]{report}
\usepackage[left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry} %Margins
\usepackage{times}
\usepackage{pdfpages}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{tocloft}
\usepackage{amsmath}
\usepackage{chngcntr }
\usepackage[toc,page]{appendix}
\usepackage[T1]{fontenc}
\usepackage[nottoc]{tocbibind}
\usepackage[compact]{titlesec}
\titlespacing{\section}{0pt}{1ex}{0ex}
\titlespacing{\subsection}{0pt}{1ex}{0ex}
\titlespacing{\subsubsection}{0pt}{1ex}{0ex}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\include{thesis.preamble}
\begin{document}
\newgeometry{left=2cm,right=2cm} %Only for the title new margins
%Title parameters
\title{Title}
\author{Student's name}
\submitdate{July 2017}
\supervisor{supervisor's name}
\cosupervisor{co-supervisor's name}
\maketitle
\maketitle
\restoregeometry
\preface
\cleardoublepage
\input{dedication/dedication}
\input{acknowledgements/acknowledgements}
\input{abstract/abstract}
\body
%Introduction of the project
\input{introduction/introduction}
\input{methods/methods}
\input{results/results}
\input{discussion/discussion}
\listoffigures
\newpage
\listoftables
% appendices come here
\bibliographystyle{naturemag}
\bibliography{bibliography}
\input{appendix/appendix}
\end{document}
I have also following code in the Latex
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{latexsym}
\input{Styles/mathchars.sty}
%\usepackage{setspace}
\usepackage{blindtext}
\usepackage{float}
\input{Styles/blocked.sty}
\input{Styles/uhead.sty}
\input{Styles/boxit.sty}
\input{Styles/icthesis.sty}
\newcommand{\titlelinespacing}{\renewcommand{\baselinestretch}{2.0} \normalsize}
\newcommand{\normallinespacing}{\renewcommand{\baselinestretch}{1.5} \normalsize}
\newcommand{\mediumlinespacing}{\renewcommand{\baselinestretch}{1.2} \normalsize}
\newcommand{\narrowlinespacing}{\renewcommand{\baselinestretch}{1.0} \normalsize}
\newtheorem{definition}{Definition}[chapter]
\newtheorem{theorem}{Theorem}[chapter]
\cftsetindents{section}{0in}{0.5in}
\cftsetindents{subsection}{0in}{0.5in}
\cftsetindents{subsubsection}{0in}{0.5in}
When I make a new paragraph, a space is generated between each paragraphs like the following image:
for the above image I have the following code :
\normallinespacing
\chapter{Introduction}
The aim of this thesis work is to understand how High-Pressure Supersonic Turbines react to the unsteady and unstationary flow conditions when they operate with Rotating Detonation Engines.
In recent years this problem has been investigated by several authors. Sun and et al[1] has investigated the effects of the diverging nozzle downstream of Rotating Detonation Engines. They have found out that the integrating diverging nozzle to Rotating Detonation Engines reduces the total pressure and temperature load downstream of Rotating Detonation Engines. Liu and Panigua[2] has also tried to intregrate this type of combustor with turbines by changing endwall shape of the first stage of the turbines. A modified endwall design has prevented the unstarting of the stator passage and enabled significant gain in performance. Paniagua and et al[3] has investigated also bladeless turbine configuration for the supersonic inlet flow. This has been done through a wavy hub surface which enables shocks and expansion fans and generates torque. Sousa[4] has also studied the designing of Supersonic Turbine according to the flow conditions downstream of Rotating Detonation Engine.
This master thesis work has the motivation to design a suitable supersonic turbine to be integrated with pressure gain combustors.
\section{Motivation}
\section{Objectives}
\section{Structure of the Report}
\newpage
I want to remove the space between each paragraphs. Do you know how to remove the space between paragraphs?
Thanks in advance!
Add the command
\setlength{\parskip}{0pt} % additional skip between paragraphs
in the preamble, and the problem should be solved.
By the way, you may get the answer faster on TEX.SX.
I am newbie in latex and trying to add figure into the latex file as follows:
\documentclass{bmcart}
%%% Load packages
\usepackage{amsthm,amsmath}
\usepackage[utf8]{inputenc} %unicode support
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{graphicx}
\def\includegraphic{}
\def\includegraphics{}
\startlocaldefs
\endlocaldefs
\begin{document}
\begin{figure}[h!]
\includegraphics{figures/GBMfigure3.jpg}
\caption{show the results of the different settings for the parameters of the penalty model for solving the problem \ref{q11}.}
\end{figure}
\end{document}
But, the figure is not displayed and the text itself is displayed instead of the figure, for example the resulted file is as below:
So, what's the solution of that issue please.
With \def\includegraphics{} you redefine the command to do nothing. If you want it to include your image, don't do such a redefinition.
\documentclass{bmcart}
%%% Load packages
\usepackage{amsthm,amsmath}
\usepackage[utf8]{inputenc} %unicode support
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{graphicx}
%\def\includegraphic{}
%\def\includegraphics{}
\startlocaldefs
\endlocaldefs
\begin{document}
\begin{figure}[h!]
\includegraphics{example-image-duck}
\caption{show the results of the different settings for the parameters of the penalty model for solving the problem \ref{q11}.}
\end{figure}
\end{document}
This question has already been answered once (wrap LaTeX command in environment), yet I still struggle to make my own rather simple new environment command work.
What I wanted to do is to convert the following LaTex block, which shows the output of some code, into a command I can reuse.
\fbox{\begin{minipage}{\textwidth}
\texttt{
>> CODE OUTPUT
\end{minipage}}
It is clear that in order to make a new environment command that replicates what I do above, I will have to make use of wrappers. (Because of the \fbox and the \texttt command.)
I would like to do this without having to download yet another package, or going into the secret realms of LaTex with some predefined \dir command that is only there to do the same job twice.
Checking the link from before, it seems that a productive solution is to use \bgroup and \egroup. I would therefore write something like this:
\newenvironment{CodeOutput}
{\fbox\bgroup\begin{minipage}{\textwidth}\texttt\bgroup}
{\egroup\end{minipage}\egroup}
Yet this will still not work. (On Overleaf at least.) It would be great if there was a straightforward way of making commands like these. Thanks for any useful suggestions!
If want to write a command that does what you're after, then the following would work:
\newcommand{\mycmd}[1]{%
\fbox{%
\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\ttfamily #1
\end{minipage}%
}%
}
The idea here works because the <arg>ument supplied to \mycmd{<arg>} is replaced by #1 in its entirety. If you want want to rewrite this as an environment, it's a little more difficult, purely because of \fbox. \fbox is doesn't have an environment-form equivalent the same way \texttt has \ttfamily (which is technically a font switch). There is a quick way around it provided by environ - it allows you to capture the contents of an environment in a macro \BODY:
\usepackage{environ}
\NewEnviron{myenvA}{%
\fbox{%
\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\ttfamily \BODY
\end{minipage}%
}%
}
However, you do have the option by capturing the content of an environment inside a box and then setting the box inside an \fbox:
\newsavebox{\codebox}% To store the content of myenvB
\newenvironment{myenvB}{%
\begin{lrbox}{\codebox}%
\ttfamily\ignorespaces
}{%
\end{lrbox}%
\fbox{\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\usebox{\codebox}%
\end{minipage}}%
}
The following minimal example shows all the above cases:
\documentclass{article}
\usepackage{environ}
\newcommand{\mycmd}[1]{%
\fbox{%
\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\ttfamily #1
\end{minipage}%
}%
}
\NewEnviron{myenvA}{%
\fbox{%
\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\ttfamily \BODY
\end{minipage}%
}%
}
\newsavebox{\codebox}
\newenvironment{myenvB}{%
\begin{lrbox}{\codebox}%
\ttfamily\ignorespaces
}{%
\end{lrbox}%
\fbox{\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\usebox{\codebox}%
\end{minipage}}%
}
\begin{document}
\noindent
\fbox{\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\ttfamily SoMe CoDe HeRe
\end{minipage}}
\bigskip
\noindent
\mycmd{SoMe CoDe HeRe}
\bigskip
\noindent
\begin{myenvA}
SoMe CoDe HeRe
\end{myenvA}
\bigskip
\begin{lrbox}{\codebox}
\ttfamily SoMe CoDe HeRe
\end{lrbox}
\noindent
\fbox{\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\usebox{\codebox}
\end{minipage}}
\bigskip
\noindent
\begin{myenvB}
SoMe CoDe HeRe
\end{myenvB}
\end{document}
How can I temporarily cause pdfLaTeX to forget everything that I've told it and start with a new document class?
I've modified the example environment from the lshort document:
\newwrite\examplesx#out
\newenvironment{examplesx}{%
\begingroup% Lets Keep the Changes Local
\#bsphack
\immediate\openout \examplesx#out \jobname.exa
\let\do\#makeother\dospecials\catcode`\^^M\active
\def\verbatim#processline{%
\immediate\write\examplesx#out{\the\verbatim#line}}%
\verbatim#start
}{%
\immediate\closeout\examplesx#out\#esphack\endgroup%
\noindent\makebox[\textwidth][l]{%
\begin{minipage}[c]{0.45\textwidth}%
\small\verbatiminput{\jobname.exa}
\end{minipage}%
\hspace*{0.1\textwidth}%
\framebox{%
\begin{minipage}{0.45\textwidth}%
\small\input{\jobname.exa}%
\end{minipage}
}%
}\vspace*{\parskip}%
}
and it mostly works, but I want to be able to do something like
\begin{examplesx}
\section{Section}
\end{examplesx}
and have it show up as a section in a box. I also would like it to typeset lists using the standard article style, even if I use it in beamer
I think that the easiest way of doing this is to compile some small document and then include the resultant pdf as an image into the larger document. Much simpler even if not exactly what you want. I have done this to show, in a Beamer presentation, what LaTeX articles look like.
Of course if its a REALLY simple document (e.g., a simple block of text) that you want to have inside beamer, I could recommend that you mimic the document with a TikZ "picture" that contains some text.
Maybe another approach: instead of trying to typeset things in beamer as if they would be done in article, simply typeset them with the article document class and include the result the in the beamer document.
With tcolorbox this can be done automatically:
% !TeX program = txs:///arara
% arara: pdflatex: {synctex: on, interaction: nonstopmode, shell: yes}
\documentclass{beamer}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{frame}[fragile]
\begin{tcblisting}{
comment only,
pdf comment,
compilable listing,
run pdflatex,
}
\documentclass{article}
\begin{document}
\section{Section Title}
test
\end{document}
\end{tcblisting}
\end{frame}
\end{document}
I have a report in LaTeX, and i have used the following commands to create my Appendix, however, my lecturer states that any divider pages should be unnumbered.
\documentclass{report}
\usepackage{appendix}
\begin{document}
\include{chap1}
\include{appendix}
\end{document}
Then in appendix.tex
\appendix
\pagestyle{empty}
\appendixpage
\noappendicestocpagenum
\addappheadtotoc
This creates the Appendices divider page, but still puts a page number on it in the footer. There is no page number in the TOC, as expected.
How can I remove it from the footer?
I looked at the appendix.sty source, and I see the problem: line 74, in the definition of \#chap#pppage, issues a \thispagestyle{plain} command, thus overriding your \pagestyle{empty} for this page. The inelegant but direct way to fix this is to redefine the command without this line - issue the following code after importing the package.
Revised, tested version
\documentclass{report}
\usepackage{appendix}
%==== The action ================
\makeatletter
\def\#chap#pppage{%
\clear#ppage
\if#twocolumn\onecolumn\#tempswatrue\else\#tempswafalse\fi
\null\vfil
\markboth{}{}%
{ \centering \interlinepenalty \#M
\normalfont \Huge \bfseries \appendixpagename\par}%
\if#dotoc#pp\addappheadtotoc\fi
\vfil\newpage
\if#twoside
\if#openright \null \thispagestyle{empty}\newpage\fi
\fi
\if#tempswa \twocolumn\fi
}
\makeatother
%==== Back to the document ========
\begin{document}
\tableofcontents
\chapter{Blah}
Rhubarb, rhubarb, rhubarb.
\appendix
\pagestyle{empty}
\appendixpage
\noappendicestocpagenum
\addappheadtotoc
\chapter{Boff}
Cabbages, cabbages, cabbages.
\end{document}
The TeX FAQ might come in handy here:
I asked for “empty”, but the page is numbered
If you use \pagestyle{empty} and you
find some pages are numbered anyway,
you are probably encountering one of
the style decisions built into the
standard LaTeX classes: that certain
special pages should always appear
with \pagestyle{plain}, with a page
number at the centre of the page foot.
The special pages in question are
those (in article class) containing a
\maketitle, or (in book and report
classes) \chapter or \part commands.
The simple solution is to reissue the
page style after the command, with
effect for a single page, as, for
example (in article):
\maketitle
\thispagestyle{empty}
So give adding \thispagestyle{empty} after your \appendix a try.
try changing \pagestyle{empty} to \thispagestyle{empty} and put it after \addappheadtotoc.
Try instead:
\pagenumbering{gobble}
\begin{appendices} \newpage
\clearpage
\pagenumbering{arabic}
\addtocounter{page}{100}
\tableofcontents
\newpage
*Special thanks to https://tex.stackexchange.com/questions/6639/removing-page-numbers-but-not-headers!