1

I already searched for a solution but found none which works for me.

My aim is to write some command inside a block environment. Even though I used \cprotect or \protect it still won't work. Normally I use \verb+Command+ for this. Do you guys have an idea how to solve this?

It's for a poster, therefore, it is used beamer. [EDIT] the second part in the code is the design part from the template

\documentclass[20pt,margin=1in,innermargin=-4.5in,blockverticalspace=-0.25in]{tikzposter}
\geometry{paperwidth=42in,paperheight=30in}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{enumitem}
\usepackage[backend=biber,style=numeric]{biblatex}
\usepackage{emory-theme}
\usepackage{pstricks}
\usepackage{xcolor}
\usepackage{pst-plot}
\usepackage{pst-circ}
\usepackage{threeparttable}
\usepackage{listings}
\usepackage{verbatim}
\usepackage{cprotect}
\usepackage{fancyvrb}


\usepackage{mwe} % for placeholder images

\addbibresource{refs.bib}

\tikzposterlatexaffectionproofoff
\usetheme{EmoryTheme}
\usecolorstyle{EmoryStyle}

\begin{document}
\maketitle
\centering
\begin{columns}
    \column{0.32}
    \block{lalala}{  

    }
    \column{0.36}
    \block{info}{
    }
    \block{basics}{
        texttexttexttexttexttexttexttexttexttexttexttexttexttext:\\
        \cprotect\verb+\usepackage{}+
    }
    \column{0.32}
    \block{something}{  
    }
\end{columns}
\end{document}     

name:emory-theme.sty

% Emory Theme for the tikzposter % package. % % Author: Blair J. Rossetti % Last Modified: 2018-11-15 % % -- COLORS -- % emory primary palette \definecolor{EmoryBlue}{HTML}{002878} % Pantone 280(primary) \definecolor{MediumBlue}{HTML}{0033a0} % Pantone 286 \definecolor{LightBlue}{HTML}{007dba} % Pantone 7461 \definecolor{Yellow}{HTML}{f2a900} % Pantone 130 \definecolor{Gold}{HTML}{b58500} % Pantone 125 \definecolor{MetallicGold}{HTML}{8d702a} % Pantone 8640 % emory secondary palette \definecolor{Cyan}{HTML}{00aeef} % Pantone Cyan \definecolor{SkyBlue}{HTML}{41b6e6} % Pantone 298 \definecolor{Teal}{HTML}{487f84} % Pantone 5483 \definecolor{KellyGreen}{HTML}{348338} % Pantone 7740 \definecolor{SeaGreen}{HTML}{006c5b} % Pantone 568 \definecolor{Olive}{HTML}{5c8118} % Pantone 370 \definecolor{Orange}{HTML}{c35413} % Pantone 1595 \definecolor{Red}{HTML}{da291c} % Pantone 485 \definecolor{Magenta}{HTML}{c6007e} % Pantone 233 \definecolor{Purple}{HTML}{6558b1} % Pantone 2102 \definecolor{Grape}{HTML}{6d2077} % Pantone 259 % emory neutrals palette \definecolor{Black}{HTML}{101820} % Pantone Black 6 \definecolor{CoolGray5}{HTML}{b1b3b3} % Pantone Cool Gray 5 \definecolor{CoolGray2}{HTML}{d0d0ce} % Pantone Cool Gray 2 \definecolor{CoolGray1}{HTML}{d9d9d9} % Pantone Cool Gray 1 % emory web palette \definecolor{LightYellow}{HTML}{ffde75} % tikzposter color palette \definecolorpalette{EmoryPalette} {
    \definecolor{colorOne}{named}{LightBlue}
    \definecolor{colorTwo}{named}{LightYellow}
    \definecolor{colorThree}{named}{Gold} } % tikzposter style \definecolorstyle{EmoryStyle} {
    \usecolorpalette{EmoryPalette} }{
    % background
    \colorlet{backgroundcolor}{white}
    \colorlet{framecolor}{white}
    % title colors
    \colorlet{titlefgcolor}{Black}
    \colorlet{titlebgcolor}{white}
    % block colors
    \colorlet{blocktitlebgcolor}{colorOne}
    \colorlet{blocktitlefgcolor}{white}
    \colorlet{blockbodybgcolor}{white}
    \colorlet{blockbodyfgcolor}{Black}
    % innerblock colors
    \colorlet{innerblocktitlebgcolor}{white}
    \colorlet{innerblocktitlefgcolor}{Black}
    \colorlet{innerblockbodybgcolor}{colorTwo}
    \colorlet{innerblockbodyfgcolor}{Black}
    % note colors
    \colorlet{notefgcolor}{Black}
    \colorlet{notebgcolor}{colorTwo}
    \colorlet{noteframecolor}{colorTwo} } % -- STYLE -- % background \definebackgroundstyle{EmoryBackgroundStyle}{
    \draw[line width=0pt, color=framecolor, fill=backgroundcolor]
    (bottomleft) rectangle (topright); } % title \definetitlestyle{EmoryTitleStyle}{
    width=\textwidth, linewidth=5pt, titletotopverticalspace=0in }{
    \begin{scope}[line width=\titlelinewidth,]
    \draw[color=colorThree!30!white,round cap-round cap]
    (\titleposleft,\titleposbottom)--(\titleposright,\titleposbottom);
    \end{scope} } % block \defineblockstyle{EmoryBlockStyle}{
    titlewidthscale=0.95, bodywidthscale=1, roundedcorners=5 }{
    \draw[color=framecolor, fill=blockbodybgcolor,
    rounded corners=\blockroundedcorners] (blockbody.south west)
    rectangle (blockbody.north east);
    \ifBlockHasTitle
    \draw[color=framecolor, fill=blocktitlebgcolor,
    rounded corners=\blockroundedcorners] (blocktitle.south west)
    rectangle (blocktitle.north east);
    \fi } % -- THEME --  % emory theme \definelayouttheme{EmoryTheme}{
    \usecolorstyle[colorPalette=EmoryPalette]{EmoryStyle}
    \usebackgroundstyle{EmoryBackgroundStyle}
    \usetitlestyle{EmoryTitleStyle}
    \useblockstyle{EmoryBlockStyle}
    \useinnerblockstyle{Default}
    \usenotestyle{Default} } % -- TITLE FORMAT -- % place logo to right of centered title \makeatletter \renewcommand\TP@maketitle{%    \centering    \begin{minipage}[b]{0.8\linewidth}
        \centering
        \color{titlefgcolor}
        {\bfseries \Huge \sc \@title \par}
        \vspace*{1em}
        {\huge \@author \par}
        \vspace*{1em}
        {\LARGE \@institute}
    \end{minipage}%
    \tikz[remember picture,overlay]\node[anchor=south east,xshift=0.5\linewidth,inner sep=0pt] {%
       \@titlegraphic
    }; } \makeatother
  • 1
    Welcome to TeX.se. Instead of showing us a list of packages can you please edit your question to show a complete compilable document (even if it gives an error) that shows the problem. Most of the packages you list won't be relevant so you should remove them from the example document. – Alan Munn Feb 24 at 14:01
  • edited it, it's a template so you probably need all these packages. sorry for the template I just don't have the time right now to create one by myself – NightyIO Feb 24 at 14:23
3

Verbatim text is not able to be used as the argument to another command. There are a couple of ways around this. One is to simply use \texttt{} directly. This is not as convenient, but it's more convenient than not being able to use it at all. Another way is to use fancyvrb to save the verbatim text beforehand and then use the saved text inside a command. I've trimmed your example to something more minimal to show both possibilities:

\documentclass[20pt,margin=1in,innermargin=-4.5in,blockverticalspace=-0.25in]{tikzposter}
\geometry{paperwidth=42in,paperheight=30in}
\usepackage[utf8]{inputenc}
\usepackage{fancyvrb}
\DefineShortVerb{\|}
\SaveVerb{verb}|\usepackage{}|


\tikzposterlatexaffectionproofoff


\begin{document}
\maketitle
\centering
\begin{columns}
    \column{0.32}
    \block{lalala}{  

    }
    \column{0.36}
    \block{info}{
    }
    \block{basics}{
        texttexttexttexttexttexttexttexttexttexttexttexttexttext:

        \texttt{\textbackslash usepackage\{\}}
        \UseVerb{verb}
    }
    \column{0.32}
    \block{something}{  
    }
\end{columns}
\end{document}   

output of part of code

3

The latest version of my fvextra package, which extends fancyvrb, provides a \Verb command that typically works fine inside other commands as long as you don't need # or % or unpaired curly braces. If you do need those or have other special requirements, fvextra also provides \EscVerb, in which any special character like # or % or unpaired braces is included by escaping it with a backslash.

\documentclass[20pt,margin=1in,innermargin=-4.5in,blockverticalspace=-0.25in]{tikzposter}
\geometry{paperwidth=42in,paperheight=30in}
\usepackage[utf8]{inputenc}
\usepackage{fvextra}

\tikzposterlatexaffectionproofoff

\begin{document}
\begin{columns}
    \column{0.36}
    \block{block title}{
        text that goes on for a while

        \Verb{\usepackage{}}

        \EscVerb{\\usepackage{}}
    }
\end{columns}
\end{document} 
  • +1: You could mention that you are the author of fvextra (which is a good thing), – Dr. Manuel Kuehner Feb 24 at 19:26
  • +1 I was unaware of this package. – Alan Munn Feb 24 at 19:30
  • 1
    @Dr.ManuelKuehner That's a good suggestion. I've updated the answer. – G. Poore Feb 24 at 21:31
  • Very subtle :). I saw, that you also make the Python package. Do you have a good starting point for the usage of your Python package? I am a Python beginner and want to use it within LaTeX. – Dr. Manuel Kuehner Feb 25 at 8:24
  • 1
    @Dr.ManuelKuehner As part of pythontex, there's a quickstart document and a gallery document. Looking at the .tex source for those, compiling them, and making small modifications would probably be a good place to begin. – G. Poore Feb 25 at 13:05

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.